Merge Word Documents in Node.js

Merge Word Documents in Node.js

Merge Word documents with Aspose Cloud Node.js library. Merge multiple files in DOCX, DOC and other formats into a single document (PDF, DOCX, etc) that is easier to send, share, print and review. Automate the merging process, reduce your paper usage, standardize the results, and make it simple for customers to navigate through it.

Why do I need to merge multiple Word documents?

If you need to cope with a permanent workflow of electronic documents, joining multiple files to a single Word document might be required on a regular basis. There are many advantages of document merging. For example, rather than sending multiple emails with multiple attachments or printing out the documents and binding them together, you can simplify the workflow by integrating this disparate data and therefore reinforcing consistency and integrity.

The simplest way to combine documents into one is to copy the content of one file and paste it into another. But doing manual copy-and-paste jobs can be quite tedious and tricky when you have a bunch of documents on hand.

Automate document merging with Node.js

Words Cloud Node.js SDK provides a simple to use and secure API to merge Word documents with fast speed and high fidelity, even in the presence of very complex formatting.

Instead of spending minutes combining files yourself, you should be able to put them together within seconds by using just a one-line method call from our Node.js SDK.

You do not need to install any software. Documents are merged in the cloud on our servers, so that it does not consume your system resources.

Tip: Splitting a Word document is also possible.
Note: As a prerequisite, you need Node.js and Words Cloud Node.js package installed on your computer.

Merge Capabilities and Features

We provide the best document-processing capabilities and features with our constantly evolving Cloud SDKs, targeting different programming languages and major platforms, and allow developers to control and customize document merging options to their specific needs.

With our Node.js library you can:

  • Combine as many documents as you like.
  • Specify options on how to join documents together.
  • Control how Header and Footers appear.
  • Control how Page Numbering is handled.
  • Control how Lists are handled.

You can try out our free App to merge Word files online and test the functionality.

Supported Document Formats

The following formats are supported: DOCX, DOC, RTF, DOTX, DOT, ODT, OTT, XML, HTML, MHTML, TXT.

How to Merge a DOCX in Node.js

  1. Install Nodejs package.
  2. Go to the Aspose Cloud Dashboard.
  3. Create a new Account to access all applications and services or Sign In to your account.
  4. Click on Applications in the left menu to get Client Id and Client Secret.
  5. Check out the Developer Guide to merge a DOCX in Node.js.
  6. Check out our GitHub repository for a complete API list along with working examples.
  7. Check out the API Reference page for the description of APIs parameters.

Merge a Word document in Node.js
const {WordsApi, AppendDocumentRequest, DocumentEntry, DocumentEntryList } = require("asposewordscloud");
var appSid = "####-####-####-####-####";
var appKey = "##################";

wordsApi = new WordsApi(appSid, appKey);

// Merge 3 documents: source.docx, append1.docx, append2.docx
var docEntry1 = new DocumentEntry({
	href: "append1.docx",
	importFormatMode: "KeepSourceFormatting"
var docEntry2 = new DocumentEntry({
	href: "append2.docx",
	importFormatMode: "UseDestinationStyles"
var docList = new DocumentEntryList({
	documentEntries: [docEntry1, docEntry2]

var request = new AppendDocumentRequest({
	name: "source.docx",
	documentList: docList,
	destFileName: "result.docx"
wordsApi.appendDocument(request).then((result) => {


Support and Learning Resources