merge word documents

MS Word files are popular office file formats for data processing and information sharing. Multiple resources work in organizations and produce numerous documents on a daily basis and for data archives, we may stumble upon a requirement to merge documents produced by multiple teams located at distant geographical locations. In this article, we are going to discuss the steps on how to combine multiple Word files into single resultant output using REST API.

Word processing REST API

The Word documents have various formats and in order to fulfill this requirement, Aspose.Words Cloud offers the capabilities to combine various MS Word and OpenOffice documents into a single file. The API allows you to append a document or documents, specified in the documentList parameter, to the original resource file. The changes are saved in the original resource document if the destFileName parameter is not specified. During documents append, we get an option to define which formatting will be used: appended or destination document. So the Possible values are KeepSourceFormatting or UseDestinationStyles.

Merge files using the cURL command

The cURL commands are the easiest way to perform Word document merge operation using RESTful APIs.

curl -X PUT "https://api.aspose.cloud/v4.0/words/Working%20with%20Header_Footer%20Objects.docx/appendDocument?destFileName=MergedFile.doc" \
-H  "accept: application/json" \
-H  "Authorization: Bearer <JWT Token>" \
-H  "Content-Type: application/json" \
-d "{\"DocumentEntries\":[{\"Href\":\"Another sample file.docx\",\"ImportFormatMode\":\"KeepSourceFormatting\"}],\"ApplyBaseDocumentHeadersAndFootersToAppendingDocuments\":true}"

Request URL

https://api.aspose.cloud/v4.0/words/Working%20with%20Header_Footer%20Objects.docx/appendDocument?destFileName=MergedFile.doc

Merge Word files using C#

C#.NET