Aspose.Words for .NET 11.11.0
I have two Word documents with a picture in each that are then merged together using the Aspose.Words for .NET Document.AppendDocument method and then saved as a new document. This new document cannot be opened by Word 2010 and a corrupt file is reported. In the new document.xml there is an id attribute that is negative in the second wp:docPr element.
<wp:docPr id="-1428715150" name="Picture 1" />
This is the merging code.
static void Main(string[] args)
{
Document destDoc = new Document();
destDoc.RemoveAllChildren();
Document source1Doc = new Document(@"..\..\in 1.docx");
destDoc.AppendDocument(source1Doc, ImportFormatMode.KeepSourceFormatting);
Document source2Doc = new Document(@"..\..\in 2.docx");
destDoc.AppendDocument(source2Doc, ImportFormatMode.UseDestinationStyles);
destDoc.Save(@"..\..\out.docx");
}
The two source documents and single output document are attached.
Thanks.
John