Free Support Forum -

Merge two Word documents into a single document

Is it possible to merge two Word Documents into a single document. Example:

Document 1 = "I am document 1"
Document 2 = "I am document 2"

Output Document = “I am document 1. {NEW PAGE BREAK} I am document 2”

Hi Lorne,

Thanks for your inquiry. You can merge documents by using Document.AppendDocument Method. Please read following documentation links for your kind reference

Appending Documents Overview
Join a Document onto another Document
How the AppendDocument Method Works
Differences between ImportFormat Modes
How to Insert a Document into another Document

Please check the following code snippet for your kind reference.

// The document that the content will be appended to.

Document dstDoc = new Document(MyDir + "Document.doc");

// The document to append.

Document srcDoc = new Document(MyDir + "DocumentBuilder.doc");

// Append the source document to the destination document.

// Pass format mode to retain the original formatting of the source document when importing it.

dstDoc.AppendDocument(srcDoc, ImportFormatMode.KeepSourceFormatting);

// Save the document.

dstDoc.Save(MyDir + "Document.AppendDocument Out.doc");

Please let us know if you have any more queries.