The merger of multiple MS Word documents could be needed in various scenarios such as reducing the number of documents, keeping similar kinds of content in a single file (i.e. invoices), and etc. Many online applications let you merge two or more MS Word documents, however, you may need to implement document merging features within your .NET applications. For such a case, in this article, you will learn how to merge MS Word DOCX documents in C#.

Merge Word Documents with C# API

Aspose.Words for .NET is a popular word processing API that lets you create, manipulate, and play with MS Word document formats within C# applications. Along with a wide range of document generation features, the API allows you to merge MS Word documents quite easily. You can download the API or install it from NuGet.

PM> Install-Package Aspose.Words

Merge MS Word DOCX Documents using C#

Merging MS Word documents using Aspose.Words for .NET is as easy as pie. Just load the documents and merge them by calling a single method. Below are the two MS Word documents that you will merge in the following code samples.

Word Documents to Merge

The following are the steps to merge two MS Word documents.

The following code sample shows how to merge MS Word documents (DOCX) using C#.

The following is the screenshot of the merged MS Word document.

Merged MS Word Documents

Combine MS Word DOCX with Additional Options

Aspose.Words for .NET also provides some additional options to customize the appearance of the source document after performing the merger. The ImportFormatOptions class provides various customization options such as IgnoreHeaderFooter, IgnoreTextBoxes, etc.

The following are the steps to merge two MS Word documents with additional options.

The following code sample shows how to merge two MS Word documents with additional options using C#.

Conclusion

In this article, you have seen how to merge MS Word DOCX documents using C#. Furthermore, you have learned how to use the additional options to customize the document merging feature. You can explore more about Aspose.Words for .NET using the documentation. In case you would have any questions, you can contact us via our forum.

See Also