Add new word document at the beginning of existing word document


I need example to add new word document (this may contain 1-3 pages) at the beginning of existing word document (this may contain 1-100 pages).

Aspose.Words.dll version

Bhaskar V

Hi Bhaskar,

Thanks for your inquiry. You can use the following simple code:

Document existingDoc = new Document(MyDir + @"existing.docx");
Document newDoc = new Document(MyDir + @"new.docx");
Document dstDoc = existingDoc.Clone();
dstDoc.AppendDocument(newDoc, ImportFormatMode.UseDestinationStyles);
dstDoc.AppendDocument(existingDoc, ImportFormatMode.UseDestinationStyles);
dstDoc.Save(MyDir + @"16.1.0.docx");

Hope, this helps.

Best regards,