How to Merge DOCX Files in .NET
Step-by-step guide to merging Word (DOCX) documents into one document using the GroupDocs.Merger.LowCode library for .NET.
Overview
This article explains how to merge several Word (DOCX) documents into one document using the Merge DOCX plugin (JoinDocx) from the GroupDocs.Merger.LowCode package for .NET. GroupDocs Document Merger Plugins are lightweight, single-purpose tools that make merging and splitting documents simple and efficient for .NET developers.
About Document Merger Plugins
GroupDocs Document Merger Plugins are built on our enterprise-grade GroupDocs.Merger SDK. These plugins merge, split, and remove pages in PDF, Word (DOCX), and PowerPoint (PPTX) documents, and are designed for cross-platform use on Windows, macOS, and Linux under .NET 6+. Each plugin offers a lightweight, fixed-price solution for one operation on one format (e.g., Merge PDF), making them ideal for developers who need a simple, focused tool.
Prerequisites
- .NET 6.0 or later
- A license file (
GroupDocs.Merger.LowCode.lic). Without a license, the plugin runs in evaluation mode. - Two or more DOCX files to merge
Installation
To install the GroupDocs.Merger.LowCode package, run the following command in your terminal:
dotnet add package GroupDocs.Merger.LowCodeCode Example
The following example appends appendix.docx to source.docx and saves the merged document to output/merged.docx:
using GroupDocs.Merger.Domain.Options;using GroupDocs.Merger.LowCode;// Set your licenseLicense.Set("GroupDocs.Merger.LowCode.lic");// Append the documents to the source DOCX documentvar merger = new JoinDocx("source.docx", new[] { "appendix.docx" }, new JoinOptions());// Save the merged DOCX documentmerger.Save("output/merged.docx");open GroupDocs.Merger.Domain.Optionsopen GroupDocs.Merger.LowCode// Set your licenseLicense.Set("GroupDocs.Merger.LowCode.lic")// Append the documents to the source DOCX documentlet merger = JoinDocx("source.docx", [ "appendix.docx" ], JoinOptions())// Save the merged DOCX documentmerger.Save("output/merged.docx")Imports GroupDocs.Merger.Domain.OptionsImports GroupDocs.Merger.LowCode' Set your licenseLicense.Set("GroupDocs.Merger.LowCode.lic")' Append the documents to the source DOCX documentDim merger As New JoinDocx("source.docx", {"appendix.docx"}, New JoinOptions())' Save the merged DOCX documentmerger.Save("output/merged.docx")Output
The merged document output/merged.docx contains the content of source.docx followed by the content of appendix.docx. The output folder is created if it doesn’t exist, and an existing file with the same name is overwritten.
Merge More Than Two DOCX Files
List the documents to append in the order they should follow the source document:
using GroupDocs.Merger.Domain.Options;using GroupDocs.Merger.LowCode;// Append chapters 2 and 3 to chapter 1var merger = new JoinDocx("chapter-1.docx", new[] { "chapter-2.docx", "chapter-3.docx" }, new JoinOptions());// Save the merged DOCX documentmerger.Save("output/book.docx");The source document can also be a Stream. For more examples in C#, VB.NET, and F#, see Using JoinDocx to Merge DOCX Documents in the documentation.
Licensing
A license is required to use the plugin without evaluation limitations. In evaluation mode, only the first three pages are processed, and an evaluation message is added to every page of the output. Each plugin is licensed separately. You can obtain a free temporary license for testing: