Error Loadingf Word XML 2003 Doc Related to Issue #3023: The document appears to be corrupted and cannot be loaded

Hello

I am experiencing the same symptons when trying to convert a Word XML document to PDF upon loading the document using Aspose.Words relating to incident #3023, namely that and error message is returned: “The document appears to be corrupted and cannot be loaded.”

Attached is the word file concerned and we are using version 3.6.1.0 of Aspose.PDF and 4.4.1.0 of Aspose.Words. I believe this issue was meant to be fixed in 4.2.3.0 of Words ?

Please advise.

Regards Marcus

Error information is as follows:

exp
{Aspose.Words.FileCorruptedException}
[Aspose.Words.FileCorruptedException]: {Aspose.Words.FileCorruptedException}
HelpLink: Nothing
InnerException: {System.ArgumentException}
Message: "The document appears to be corrupted and cannot be loaded."
Source: "Aspose.Words"
StackTrace: " at Aspose.Words.Document.?(Exception ?)
at Aspose.Words.Document.?(Stream ?, LoadFormat ?, String ?)
at Aspose.Words.Document…ctor(String fileName, LoadFormat loadFormat, String password)
at Aspose.Words.Document…ctor(String fileName)
at GrantSystem.Common.PDF.PDFUtils.WordToPdf(String SourceFileName, String TargetFileName) in C:\VSS\GrantSystem\Production\dotNET\Common\PDF\PDFUtils.vb:line 55
at GrantSystem.Common.PDF.PDFUtils.ConvertToPDF(String SourceFileName, String TargetFileName, eSourceFormat SourceFormat) in C:\VSS\GrantSystem\Production\dotNET\Common\PDF\PDFUtils.vb:line 463
at TestPDFUtils.Form1.Button2_Click(Object sender, EventArgs e) in C:\VSS\GrantSystem\Production\dotNET\Common\PDF\TestHarness\Form1.vb:line 137"
TargetSite: {System.Reflection.RuntimeMethodInfo}
?exp.InnerException 
{System.ArgumentException}
[System.ArgumentException]: {System.ArgumentException}
HelpLink: Nothing
InnerException: Nothing
Message: "Item has already been added. Key in dictionary: "8" Key being added: "8""
Source: "mscorlib"
StackTrace: " at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
at System.Collections.Hashtable.Add(Object key, Object value)
at C.?.?(? ?)
at C.?.?(Paragraph ?, ? ?)
at C.?.?(? ?)
at C.?.?(CompositeNode ?, ? ?)
at C.?.?(? ?)
at C.?.?(Row ?, ? ?)
at C.?.?(? ?)
at C.?.?(CompositeNode ?, ? ?)
at C.?.?(? ?)
at C.?.?(Stream ?, Document ?)
at Aspose.Words.Document.?(Stream ?, LoadFormat ?, String ?)"
TargetSite: {System.Reflection.RuntimeMethodInfo}

Hi
Thanks for your request. Could you please reattach your document. I will try to reproduce this problem and provide you more information.
Best regards.

Re-attached as requested.

Regards Marcus

Hi
Thanks for additional information. I managed to reproduce the problem. I created an issue #4063 in our defects database and we will investigate whether and when it can be fixed. Please expect a reply before the next hotfix (within 2-3 weeks).
Best regards.

I’ve fixed this and will release soon.
But you can workaround because your document is not valid WordML.
It has the following problems:
There are bookmarks with duplicate id. See aml:annotation, each should have a unique ID. Aspose.Words used to fail on a duplicate bookmark id.
There are several bookmarks with the same name “AnonRef”. This is not valid either.

Roman
Many thanks for the response. I’ll look at the bookmarks issue, however, it is interesting that Word allows one to save the document with those errors in it!
Regards Marcus

Roman
Is the incident for this issue (#4063) fixed in the 4.4.2.0 version of Aspose.Words or will this be in a patch?
Regards Marcus

Hi
Thanks for your inquiry. This fix will be available in the next release within one or two weeks.
Best regards.

We have released a new version of Aspose.Words that contains a fix for your issue.
issue #4063 - “FileCorruptedException” exception occurs during opening WML document.
The new version of Aspose.Words is available for download from here.
Best regards.