We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Add new word document at the beginning of existing word document

Hi,


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 11.11.0.0

Thanks,
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.RemoveAllChildren();

dstDoc.AppendDocument(newDoc, ImportFormatMode.UseDestinationStyles);

dstDoc.AppendDocument(existingDoc, ImportFormatMode.UseDestinationStyles);

dstDoc.Save(MyDir + @"16.1.0.docx");


Hope, this helps.

Best regards,