Working with Docs/Docx files becomes a hassle when data is scattered among multiple Word files. This scenario leads to a waste of time and valuable manpower. Fortunately, GroupDocs.Merger is the solution to this problem as it offers REST APIs and cloud SDKs to merge Word documents into a single file. In addition, this Word document merger API lets users configure API calls as per requirements. In this blog post, we will explore how to join Word documents in a Node.js-based application using GroupDocs.Merger Cloud SDK for Node.js.
We will cover the following points in this article:
- Word Document Merger API Installtion
- Join Word Documents in Node.js Programmatically
- Join Word Documents Online
Word Document Merger API Installtion
It is quite straightforward to install GroupDocs.Merger Cloud Node.js SDK in a Node.js-based project. Simply run the following command in the terminal and start leveraging its enterprise-level methods to join Word files programmatically.
npm install groupdocs-merger-cloud
Join Word Documents in Node.js Programmatically
This section demonstrates the actual implementation of the functionality. We have uploaded two different Docs/Docx files on the API cloud dashboard. So, you can upload the files manually and programmatically too.
The following are the steps to join Word documents programmatically:
- Include the groupdocs-merger-cloud module in your app.
- Instantiate the DocumentApi with the API credentials.
- Create an instance of the JoinItem class.
- Instantiate an object of the FileInfo class.
- Set the file path of the source Word file.
- Create an object of the JoinOptions class.
- Invoke the JoinItems property to assign the source document array.
- Set the output path for the generated document.
- Initialize an instance of the JoinRequest class and pass it into the join method.
The following code snippet shows how to merge Word documents using Node.js:
The above code snippet will merge Word documents and create the generated file in the “Output” folder. However, you can download the file manually or programmatically by calling the DownloadFile method.
Join Word Documents Online
GroupDocs.Merger offers an online version of SDKs to merge Word documents. All you need to do is, just drop/upload the Docs/Docx file and hit the “Merge Now” button. Above all, you do not need any prior subscription to use this online Word document merger.
We hope you have learned how to join Word documents using GroupDocs.Merger Cloud SDK. In addition, we also have gone through the steps and the code sample to achieve the functionality. Moreover, this Word document merger API is easy to use and integrate with your Node.js-based project. Therefore, do not skip the documentation to learn about other useful features. In fact, you can interact with our APIs here directly and also find the source code in the GitHub repo.
Further, we recommend you follow our Getting Started guide.
Finally, groupdocs.cloud is writing new articles. So, please stay in touch for the latest updates.
Ask a question
You can let us know about your questions or queries on our forum.
Frequently Asked Questions – FAQs
Is there a way to join Word documents together?
GroupDocs.Merger Cloud SDK offers a wide stack of methods and properties to merge Word documents programmatically. For that, you can initialize an instance of the JoinRequest class and pass it into the join method to join Word documents.
How to combine 2 Word documents?
Please visit this link to know the answer in detail.