Free Support Forum - aspose.com

Merge word documents with headers

We have a requirement to merge word documents. We are exploring how to merge headers in the merged document. So if there are 2 word documents. The first document is having 1 page with header having image 1. The second document is having 1 page with header having image 2. What we need is to merge the document such that merged document having 2 pages, first page having page 1 content & header with image 1 from first document and second page having page 2 content & header with image 2 from second document. Does aspose support this kind of merge? Thanks

@mukeshgohil,

Thanks for your inquiry. Yes, you can achieve your requirements using Aspose.Words. Please refer to the following article.
Joining and Appending Documents

Please check the following code example. Hope this helps you.

Document dstDoc = new Document(MyDir + "Doc 1.docx");
Document srcDoc = new Document(MyDir + "Doc 2.docx");
                 
// Append the source document using the original styles found in the source document.
dstDoc.AppendDocument(srcDoc, ImportFormatMode.KeepSourceFormatting);

dstDoc.Save(MyDir + "18.5.docx");