Οι προγραμματιστές του Node.js via .NET μπορούν εύκολα να δημιουργήσουν DOC χρησιμοποιώντας μόνο το ισχυρό API προϊόντων μας. Σημαίνει ότι η λύση μας θα παρέχει στους προγραμματιστές όλα όσα χρειάζονται για να δημιουργήσουν το DOC στο JavaScript.
Με τη βιβλιοθήκη JavaScript, οι προγραμματιστές μπορούν εύκολα να δημιουργήσουν το DOC από την αρχή. Για να γίνει αυτό, οι προγραμματιστές Node.js via .NET πρέπει να εκτελέσουν μερικά μόνο βήματα:
Αξίζει να σημειωθεί ότι ένα κενό έγγραφο τεχνικά υποτίθεται ότι περιέχει μία παράγραφο, επομένως όταν δημιουργείτε μέσω προγραμματισμού ένα DOC έγγραφο, θα έχετε ακριβώς αυτή τη βασική δομή εγγράφου.
Σημειώστε ότι μπορείτε να προσθέσετε άμεσα περιεχόμενο σε ένα DOC αρχείο που δημιουργήθηκε πρόσφατα. Έτσι, δεν θα λάβετε απλώς ένα κενό έγγραφο, αλλά ένα έγγραφο που περιέχει το απαραίτητο περιεχόμενο. Για περισσότερες πληροφορίες σχετικά με τον τρόπο επεξεργασίας ενός εγγράφου, ανατρέξτε στη σελίδα Επεξεργασία.
Αυτή η βιβλιοθήκη Node.js via .NET σάς επιτρέπει να δημιουργείτε μέσω προγραμματισμού DOC έγγραφα. Δοκιμάστε την ισχυρή μας λειτουργικότητα και δείτε πώς μπορείτε να δημιουργήσετε DOC σε ορισμένες μορφές χρησιμοποιώντας το ακόλουθο παράδειγμα:
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.doc")
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.doc")
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.doc", 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.doc")
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.doc")
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.doc", 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.doc")
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.doc")
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.doc", 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.doc")
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.doc")
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.doc", saveOptions)
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.
This package is compatible with Node.js 14.17.0 or higher.
Μπορείτε να δημιουργήσετε έγγραφα σε άλλες μορφές αρχείων: