Node.js via .NET लाइब्रेरी का उपयोग करके DOCX बनाएं

हमारी शक्तिशाली JavaScript लाइब्रेरी डेवलपर्स को कुछ ही चरणों में प्रोग्रामेटिक रूप से DOCX बनाने की अनुमति देती है

Node.js via .NET डेवलपर केवल हमारे शक्तिशाली उत्पाद API का उपयोग करके आसानी से DOCX बना सकते हैं। इसका मतलब है कि हमारा समाधान प्रोग्रामर को JavaScript में DOCX बनाने के लिए आवश्यक हर चीज प्रदान करेगा।

कोड स्निपेट देखें

प्रोग्रामेटिक रूप से JavaScript में DOCX बनाएं

हमारी JavaScript लाइब्रेरी के साथ डेवलपर्स आसानी से स्क्रैच से DOCX बना सकते हैं। ऐसा करने के लिए, Node.js via .NET डेवलपर्स को बस कुछ कदम उठाने होंगे:

  1. फ़ाइल नाम जोड़ें
  2. JavaScript का उपयोग करके DOCX दस्तावेज़ बनाना प्रारंभ करें
  3. आउटपुट DOCX सहेजें

यह ध्यान देने योग्य है कि एक खाली दस्तावेज़ में तकनीकी रूप से एक पैराग्राफ होना चाहिए, इसलिए जब आप प्रोग्रामेटिक रूप से DOCX बनाते हैं, तो आपको बिल्कुल वही मूल दस्तावेज़ संरचना मिलेगी।

ध्यान दें कि आप नव निर्मित DOCX में तुरंत सामग्री जोड़ सकते हैं। इस प्रकार, आपको न केवल एक खाली दस्तावेज़ मिलेगा, बल्कि आवश्यक सामग्री वाला एक दस्तावेज़ भी मिलेगा। किसी दस्तावेज़ को संपादित करने के तरीके के बारे में अधिक जानकारी के लिए संपादन पृष्ठ देखें।

JavaScript में अपना DOCX बनाएं

दी गई Node.js via .NET लाइब्रेरी आपको प्रोग्रामेटिक रूप से DOCX बनाने की अनुमति देती है। हमारी शक्तिशाली कार्यक्षमता आज़माएँ और देखें कि निम्नलिखित उदाहरण का उपयोग करके कुछ प्रारूपों में DOCX कैसे बनाया जाए:

JavaScript का उपयोग करके एक नया DOCX बनाएं
सूची से लक्ष्य प्रारूप का चयन करें
कोड चलाएँ
npm install @aspose/words
प्रतिलिपि
const aw = require('@aspose/words');

var doc = new aw.Document()
var builder = new aw.DocumentBuilder(doc)

font = builder.font
font.name = "Courier New"
font.color = '#FF0000'
font.size = 36
font.highlightColor = '#F0DB4F'

builder.write("Morbi enim nunc faucibus a.")

doc.save("Output.docx")
const aw = require('@aspose/words'); var doc = new aw.Document() var builder = new aw.DocumentBuilder(doc) var firstRun = new aw.Run(doc, "Proin eros metus, sagittis sed. ") var secondRun = new aw.Run(doc, "Morbi enim nunc faucibus a.") doc.firstSection.body.firstParagraph.appendChild(firstRun) doc.firstSection.body.firstParagraph.appendChild(secondRun) builder.moveTo(secondRun) builder.startBookmark("Aspose bookmark") // यदि NextSibling शून्य है, तो सबसे अधिक संभावना है कि यह पैराग्राफ में अंतिम रन है ।. if (secondRun.nextSibling != null) builder.moveTo(secondRun.nextSibling) else builder.moveTo(secondRun.parentParagraph) builder.endBookmark("Aspose bookmark") doc.save("Output.docx") const aw = require('@aspose/words'); var doc = new aw.Document() var builder = new aw.DocumentBuilder(doc) var firstRun = new aw.Run(doc, "Proin eros metus, sagittis sed. ") var secondRun = new aw.Run(doc, "Morbi enim nunc faucibus a.") doc.firstSection.body.firstParagraph.appendChild(firstRun) doc.firstSection.body.firstParagraph.appendChild(secondRun) builder.moveTo(secondRun) builder.startBookmark("Aspose bookmark") // यदि NextSibling शून्य है, तो सबसे अधिक संभावना है कि यह पैराग्राफ में अंतिम रन है ।. if (secondRun.nextSibling != null) builder.moveTo(secondRun.nextSibling) else builder.moveTo(secondRun.parentParagraph) builder.endBookmark("Aspose bookmark") var saveOptions = new aw.Saving.PdfSaveOptions() saveOptions.outlineOptions.bookmarksOutlineLevels.add("Aspose bookmark", 1); doc.save("Output.docx", saveOptions)
const aw = require('@aspose/words');

var doc = new aw.Document()

var run = new aw.Run(doc, "Proin eros metus, sagittis sed.")
var para = doc.firstSection.body.firstParagraph
para.appendChild(run)

var comment = new aw.Comment(doc)
comment.author = "John Doe"
comment.initial = "JD"
comment.dateTime = new Date()
comment.setText("Quisque fringilla leo.")

var commentRangeStart = new aw.CommentRangeStart(doc, comment.id)
var commentRangeEnd = new aw.CommentRangeEnd(doc, comment.id)

run.parentNode.insertBefore(commentRangeStart, run)
run.parentNode.insertAfter(commentRangeEnd, run)
commentRangeEnd.parentNode.insertAfter(comment, commentRangeEnd)

comment.addReply("Jane Doe", "JD", new Date(), "Pellentesque vel sapien justo.")

doc.save("Output.docx")
const aw = require('@aspose/words'); var doc = new aw.Document() var builder = new aw.DocumentBuilder(doc) var firstRun = new aw.Run(doc, "Proin eros metus, sagittis sed. ") var secondRun = new aw.Run(doc, "Morbi enim nunc faucibus a.") doc.firstSection.body.firstParagraph.appendChild(firstRun) doc.firstSection.body.firstParagraph.appendChild(secondRun) builder.moveTo(secondRun) builder.startBookmark("Aspose bookmark") // यदि NextSibling शून्य है, तो सबसे अधिक संभावना है कि यह पैराग्राफ में अंतिम रन है ।. if (secondRun.nextSibling != null) builder.moveTo(secondRun.nextSibling) else builder.moveTo(secondRun.parentParagraph) builder.endBookmark("Aspose bookmark") doc.save("Output.docx") const aw = require('@aspose/words'); var doc = new aw.Document() var builder = new aw.DocumentBuilder(doc) var firstRun = new aw.Run(doc, "Proin eros metus, sagittis sed. ") var secondRun = new aw.Run(doc, "Morbi enim nunc faucibus a.") doc.firstSection.body.firstParagraph.appendChild(firstRun) doc.firstSection.body.firstParagraph.appendChild(secondRun) builder.moveTo(secondRun) builder.startBookmark("Aspose bookmark") // यदि NextSibling शून्य है, तो सबसे अधिक संभावना है कि यह पैराग्राफ में अंतिम रन है ।. if (secondRun.nextSibling != null) builder.moveTo(secondRun.nextSibling) else builder.moveTo(secondRun.parentParagraph) builder.endBookmark("Aspose bookmark") var saveOptions = new aw.Saving.PdfSaveOptions() saveOptions.outlineOptions.bookmarksOutlineLevels.add("Aspose bookmark", 1); doc.save("Output.docx", saveOptions)
const aw = require('@aspose/words');

var doc = new aw.Document()
var builder = new aw.DocumentBuilder(doc)

var firstRun = new aw.Run(doc, "Proin eros metus, sagittis sed. ")
var secondRun = new aw.Run(doc, "Morbi enim nunc faucibus a.")
doc.firstSection.body.firstParagraph.appendChild(firstRun)
doc.firstSection.body.firstParagraph.appendChild(secondRun)

builder.moveTo(secondRun)
builder.startBookmark("Aspose bookmark")
// यदि NextSibling शून्य है, तो सबसे अधिक संभावना है कि यह पैराग्राफ में अंतिम रन है ।.
if (secondRun.nextSibling != null)
    builder.moveTo(secondRun.nextSibling)
else
    builder.moveTo(secondRun.parentParagraph)
builder.endBookmark("Aspose bookmark")

doc.save("Output.docx")
const aw = require('@aspose/words'); var doc = new aw.Document() var builder = new aw.DocumentBuilder(doc) var firstRun = new aw.Run(doc, "Proin eros metus, sagittis sed. ") var secondRun = new aw.Run(doc, "Morbi enim nunc faucibus a.") doc.firstSection.body.firstParagraph.appendChild(firstRun) doc.firstSection.body.firstParagraph.appendChild(secondRun) builder.moveTo(secondRun) builder.startBookmark("Aspose bookmark") // यदि NextSibling शून्य है, तो सबसे अधिक संभावना है कि यह पैराग्राफ में अंतिम रन है ।. if (secondRun.nextSibling != null) builder.moveTo(secondRun.nextSibling) else builder.moveTo(secondRun.parentParagraph) builder.endBookmark("Aspose bookmark") doc.save("Output.docx") const aw = require('@aspose/words'); var doc = new aw.Document() var builder = new aw.DocumentBuilder(doc) var firstRun = new aw.Run(doc, "Proin eros metus, sagittis sed. ") var secondRun = new aw.Run(doc, "Morbi enim nunc faucibus a.") doc.firstSection.body.firstParagraph.appendChild(firstRun) doc.firstSection.body.firstParagraph.appendChild(secondRun) builder.moveTo(secondRun) builder.startBookmark("Aspose bookmark") // यदि NextSibling शून्य है, तो सबसे अधिक संभावना है कि यह पैराग्राफ में अंतिम रन है ।. if (secondRun.nextSibling != null) builder.moveTo(secondRun.nextSibling) else builder.moveTo(secondRun.parentParagraph) builder.endBookmark("Aspose bookmark") var saveOptions = new aw.Saving.PdfSaveOptions() saveOptions.outlineOptions.bookmarksOutlineLevels.add("Aspose bookmark", 1); doc.save("Output.docx", saveOptions)
const aw = require('@aspose/words');

var doc = new aw.Document()
var builder = new aw.DocumentBuilder(doc)

shape = builder.insertChart(aw.Drawing.Charts.ChartType.Pie, 432, 252)
chart = shape.chart
chart.title.text = "Demo Chart"

chart.series.clear()
chart.series.add("Series 1",
    ["Category1", "Category2", "Category3"],
    [2.7, 3.2, 0.8])

doc.save("Output.docx")
const aw = require('@aspose/words'); var doc = new aw.Document() var builder = new aw.DocumentBuilder(doc) var firstRun = new aw.Run(doc, "Proin eros metus, sagittis sed. ") var secondRun = new aw.Run(doc, "Morbi enim nunc faucibus a.") doc.firstSection.body.firstParagraph.appendChild(firstRun) doc.firstSection.body.firstParagraph.appendChild(secondRun) builder.moveTo(secondRun) builder.startBookmark("Aspose bookmark") // यदि NextSibling शून्य है, तो सबसे अधिक संभावना है कि यह पैराग्राफ में अंतिम रन है ।. if (secondRun.nextSibling != null) builder.moveTo(secondRun.nextSibling) else builder.moveTo(secondRun.parentParagraph) builder.endBookmark("Aspose bookmark") doc.save("Output.docx") const aw = require('@aspose/words'); var doc = new aw.Document() var builder = new aw.DocumentBuilder(doc) var firstRun = new aw.Run(doc, "Proin eros metus, sagittis sed. ") var secondRun = new aw.Run(doc, "Morbi enim nunc faucibus a.") doc.firstSection.body.firstParagraph.appendChild(firstRun) doc.firstSection.body.firstParagraph.appendChild(secondRun) builder.moveTo(secondRun) builder.startBookmark("Aspose bookmark") // यदि NextSibling शून्य है, तो सबसे अधिक संभावना है कि यह पैराग्राफ में अंतिम रन है ।. if (secondRun.nextSibling != null) builder.moveTo(secondRun.nextSibling) else builder.moveTo(secondRun.parentParagraph) builder.endBookmark("Aspose bookmark") var saveOptions = new aw.Saving.PdfSaveOptions() saveOptions.outlineOptions.bookmarksOutlineLevels.add("Aspose bookmark", 1); doc.save("Output.docx", saveOptions)
कोड चलाएँ

JavaScript में DOCX कैसे बनाएं

  1. Aspose.Words for Node.js via .NET करें
  2. अपने JavaScript प्रोजेक्ट. में लाइब्रेरी संदर्भ जोड़ें (लाइब्रेरी आयात करें)
  3. एक नया DOCX दस्तावेज़ बनाएं
  4. फ़ाइल नाम पास करते हुए save() विधि को कॉल करें
  5. परिणाम को एक अलग फ़ाइल के रूप में प्राप्त करें

JavaScript लाइब्रेरी बनाने के लिए DOCX

We host our Node.js via .Net packages in NPM repositories. Please follow the step-by-step instructions on how to install "Aspose.Words for Node.js via .NET" to your developer environment.

System Requirements

This package is compatible with Node.js 14.17.0 or higher.

अन्य समर्थित फ़ाइल स्वरूप

आप अन्य फ़ाइल स्वरूपों में दस्तावेज़ बना सकते हैं:

5%

उत्पाद अपडेट के लिए सदस्यता लें

मासिक न्यूज़लेटर और ऑफ़र सीधे आपके मेलबॉक्स में प्राप्त करें।

© Aspose Pty Ltd 2001-2025. सर्वाधिकार सुरक्षित।