UpdateFields Document with Line Drawing content results in corrupt document

I have a document that has a signature line at the bottom of it. If I call the Document.UpdateFields on this document it results in invalid XML, loading with the error message, "We’re sorry. We can’t open .docx because we found a problem with its contents.

Before: After(V15.12.0.0/2015.12.31): After(V14.4.0.0/2014.04.30) :
<a:pathLst><a:path w="2316480"><a:moveTo><a:pt x="0" y="0" /></a:moveTo><a:lnTo><a:pt x="2316480" y="0" /></a:lnTo></a:path></a:pathLst> <a:pathLst><a:path fill="norm" h="-1" w="2316480" stroke="1"><a:moveTo><a:pt x="0" y="0" /></a:moveTo><a:lnTo><a:pt x="2316480" y="0" /></a:lnTo></a:path></a:pathLst> <a:pathLst><a:path w="2316480"><a:moveTo><a:pt x="0" y="0" /></a:moveTo><a:lnTo><a:pt x="2316480" y="0" /></a:lnTo></a:path></a:pathLst>

Notice in the above table that version 15.12.0.0 adds an “h” attribute to the “path” element of -1(which is an invalid height). Removing this attribute allows the document to load without the error message.

Hi Nathan,

Thanks for your inquiry. We have tested the scenario using latest version of Aspose.Words for .NET 15.12.0 and have not found the shared issue. We have used following code example to test this scenario. The document is successfully opened in MS Word 2013. The document.xml also does not contains ‘h=“-1”’. Please check the attached output document.

Document doc = new Document(MyDir + "Document1.docx");
doc.UpdateFields();
doc.Save(MyDir + "Out.docx");

Attached is a zip file containing the application I used to reproduce. It contains an embedded resource of the document in question. The full vbproj is included except the license file which will need to be included for it to work(Aspose.Total.lic). Also note that this error does not occur with a trial license, a purchased license has to be used.

Hi Nathan,

Thanks for sharing the detail. We have used the shared application to test the scenario and have not found the shared issue. The document.xml does not contains ‘h="-1"’. Please check the attached output document.

I downloaded the zip file from my post, added the Aspose.Total.lic file to the bin/debug folder and ran ConsoleApplication1.exe. Upon completing, it opened a word file into Word 2013 with a message box with the error message in it. At no point did I touch Document1.docx, I have seen finicky results when opening that file before running the application.

Hi Nathan,

Thanks for sharing the detail. We have repeated the same steps as of yours. No issue while opening the document in MS Word 2013. See the attached image for detail. We tested this scenario at Windows 7 (64 bit).

Could you please share your environment detail e.g Operating system, .NET Framework etc? Please also share the screenshot of message box with the error message of MS Word 2013. We will test the scenario and share our finding here for your reference.

Windows 7 64bit
.NET 4.5.2

Attached is a screenshot of the message box that I mentioned in the first post.

Hi Nathan,

Thanks for sharing the detail. In your shared application, the Aspose.Words DLL in the bin\Debug folder has version 14.10.0. Please remove this DLL from bin\Debug folder and also remove the Aspose.Words reference from your application. Add Aspose.Words for .NET 15.12.0 reference in your application. Clean your application and execute the same application again. This will fix the shared issue.

Please let us know if you have any more queries.

Thank your for your help. When I tried the newer dll, it must have been overwritten with the old one.

Hi Nathan,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.