Merge files

GroupDocs.Merger allows to merge multiple documents into single document nice and easy. The result will contain the content of all source documents with all data, styles and formatting. Here are the simple steps to merge several documents of any supported format:

  • Instantiate Merger object with source document path or stream;
  • Call Join method and pass next merged document file path or stream to it. Repeat this step for every merged document.
  • Call Save method specifying file path to save resultant document.

The following code sample demonstrates how to merge documents:

using (Merger merger = new Merger(@"c:\sample1.docx"))
{
    merger.Join(@"c:\sample2.docx");
    merger.Join(@"c:\sample3.docx");
    merger.Save(@"c:\merged.docx");
}

Please learn more about how to merge PDF, Microsoft Word, Microsoft PowerPoint or Open Document documents from the articles listed below:

More resources

Advanced Usage Topics 

To learn more about document merging features, please refer the advanced usage section.

GitHub Examples 

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online App

Along with full featured .NET library we provide simple, but powerful free Apps.
You are welcome to merge your documents with our free online GroupDocs Merger App.