Merge Word documents

How to merge DOC 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). 

GroupDocs.Merger API provides different overloads of join method to combine additional files with the source document loaded into Merger object. 

  • 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(StringIJoinOptions) - is used for merging specific pages for document stored at local disk; 
  • join(InputStreamIJoinOptions) - 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.doc"); 
merger.join(@"c:\document2.doc");
merger.save(@"c:\merged.doc");

Code Examples

Please find more use-cases and complete Java sources of our backend and frontend examples and try them for free!

© Aspose Pty Ltd 2001-2022. All Rights Reserved.