Merge Word documents
GroupDocs.Merger provides an easy way to merge Microsoft Word documents of DOC, DOCX, DOCM, DOT, DOTX, DOTM, RTF formats and Open Document formats like ODT, OTT etc. It takes just single line of code to append one document to another preserving all content - page setup, headers and footers, formatting, styles and other content. There is no third-party applications required (like Microsoft Word and Open Office).
- join(String) - allows to merge document provided via file path on a local disk;
- join(InputStream) - provides an ability to combine documents loaded from any source - memory stream, remote URL etc.;
- join(String, IJoinOptions) - is used for merging specific pages for document stored at local disk;
- join(InputStream, IJoinOptions) - used for merging specific pages from document provided as a stream.
This code sample shows how to merge Microsoft Word documents:
Merger merger = new Merger(@"c:\document1.docx"); merger.join(@"c:\document2.docx"); merger.save(@"c:\merged.docx");
Advanced Usage Topics
To learn more about document merging features, please refer the advanced usage section.
You may easily run the code above and see the feature in action in our GitHub examples:
- GroupDocs.Merger for .NET examples, plugins and showcase
- GroupDocs.Merger for Java examples, plugins and showcase
Free Online App
Along with full featured Java library we provide simple, but powerful free Apps. You are welcome to merge your documents with our free online GroupDocs Merger App.