When developers modify a text document with this JavaScript library, what is actually being edited is the Document Object Model (DOM). Thus, almost any changes can be made to the text document represented as DOM. With the provided Node SDK, developers can easily edit a document: modify text, update tables, add images and so on. Just load a text, make the necessary changes programmatically and export the result to the same or any supported save format.
Our Node library gives developers the ability to modify a text document directly by editing its Document Object Model (DOM), which means no additional software needs to be installed.
The most popular case to edit a text file is text editing. With the given software solution, you can add, modify or delete text using JavaScript within the document.
Another popular text editing option is table editing. Our Node SDK allows you to work with tables and text in table cells.
JavaScript developers can add or remove table and table cells, as well as add, edit and remove text within them.
Besides editing text and tables in text, there is another common option: adding images to a document in JavaScript. Node developers can also add an image into a text file using DOM.
Try this powerful Node SDK and evaluate some options in text document editing. Using the following example, load your text document and make some changes: add text, add a table and a table cell with text or insert an image into the text document:
import * as fs from "fs";
const wordsApi = new WordsApi("####-####-####-####-####", "##################");
const requestDocument = fs.createReadStream("Input.txt");
const requestParagraph = new model.ParagraphInsert({
text: "Morbi enim nunc faucibus a."
})
const insertParagraphRequest = new model.InsertParagraphOnlineRequest({
document: requestDocument,
paragraph: requestParagraph
});
wordsApi.insertParagraphOnline(insertParagraphRequest)
.then((insertParagraphResult) => {
const requestDocument = insertParagraphResult.Document.Values();
const convertDocument = new model.ConvertDocumentRequest({
document: requestDocument,
format: "txt"
});
wordsApi.convertDocument(convertDocument)
.then((convertDocumentResult) => {
console.log("Result of ConvertDocument: ", convertDocumentResult);
});
});
import * as fs from "fs";
const wordsApi = new WordsApi("####-####-####-####-####", "##################");
const requestDocument = fs.createReadStream("Input.txt");
const requestTable = new model.TableInsert({
columnsCount: 1,
rowsCount: 2
})
const insertTableRequest = new model.InsertTableOnlineRequest({
document: requestDocument,
table: requestTable,
nodePath: ""
});
wordsApi.insertTableOnline(insertTableRequest)
.then((insertTableResult) => {
const requestDocument = insertTableResult.Document.Values();
const convertDocument = new model.ConvertDocumentRequest({
document: requestDocument,
format: "txt"
});
wordsApi.convertDocument(convertDocument)
.then((convertDocumentResult) => {
console.log("Result of ConvertDocument: ", convertDocumentResult);
});
});
import * as fs from "fs";
const wordsApi = new WordsApi("####-####-####-####-####", "##################");
const requestDocument = fs.createReadStream("Input1.txt");
const requestDrawingObject = new model.DrawingObjectInsert({
height: 0,
left: 0,
top: 0,
width: 0,
relativeHorizontalPosition: model.DrawingObjectInsert.RelativeHorizontalPositionEnum.Margin,
relativeVerticalPosition: model.DrawingObjectInsert.RelativeVerticalPositionEnum.Margin,
wrapType: model.DrawingObjectInsert.WrapTypeEnum.Inline
})
const requestImageFile = fs.createReadStream("Input2.txt");
const insertDrawingObjectRequest = new model.InsertDrawingObjectOnlineRequest({
document: requestDocument,
drawingObject: requestDrawingObject,
imageFile: requestImageFile,
nodePath: "sections/0"
});
wordsApi.insertDrawingObjectOnline(insertDrawingObjectRequest)
.then((insertDrawingObjectResult) => {
const requestDocument = insertDrawingObjectResult.Document.Values();
const convertDocument = new model.ConvertDocumentRequest({
document: requestDocument,
format: "txt"
});
wordsApi.convertDocument(convertDocument)
.then((convertDocumentResult) => {
console.log("Result of ConvertDocument: ", convertDocumentResult);
});
});
Install 'Aspose.Words Cloud SDK for Node.js' using NPM package manager. Run npm install asposewordscloud --save from the command line to install the SDK via the NPM package manager. As an alternative, you can manually clone Aspose.Words Cloud SDK for Node.js source code from GitHub and use it in your project. Please follow these Instructions to quickly get the necessary security credentials and access our REST API.
Refer to the Repository Documentation to see more details.