Free Support Forum - aspose.com

Appending Documents with Pictures causes Corrupt docx

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)<?xml:namespace prefix = o />

{

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

Hi John,

Thanks for your inquiry. I have managed to reproduce the same issue at my side. I have logged this issue as WORDSNET-7618 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-7618) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.