Free Support Forum - aspose.com

Aspose words causes an error with unordered lists with following WordML

Using Aspose.Words version 5.0.2.0 in .Net 2.0 an error occurs with the attacted wordml file using the following code
string WordML = wordml from file
using (MemoryStream stream = newMemoryStream(Encoding.UTF8.GetBytes(WordML)))
{
try
{
MemoryStream s = new MemoryStream();
Aspose.Words.Document doc;
doc = new Aspose.Words.Document(stream, null, Aspose.Words.LoadFormat.WordML, null);
doc.Save(s, Aspose.Words.SaveFormat.Doc);

}
catch (Exception ex)
{
throw ex;
}
}

The following error occurs
The document appears to be corrupted and cannot be loaded. —> System.ArgumentNullException: Value cannot be null.
Parameter name: String
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Int32.Parse(String s)
at ?.?.?(String ?)
at ?.?.?(? ?)
at ?.?.?(? ?)
at ?.?.?()
at Aspose.Words.Document.?(Stream ?, LoadFormat ?, String ?)
— End of inner exception stack trace —
at Aspose.Words.Document.?(Exception ?)
at Aspose.Words.Document.?(Stream ?, LoadFormat ?, String ?)
at Aspose.Words.Document…ctor(Stream stream, String baseUri, LoadFormat loadFormat, String password)

When I open the wordml in microsoft word it opens fine.

Thanks


Hi

Thanks for your reporting this to us. I managed to reproduce this problem. I have created new issue #4713 in our defect database. Please expect a reply before the next hotfix (within 2-3 weeks). We might just fix it by then or provide more information.

Best regards.

I narrowed down the problem to the use of

<w:lvlOverride>
<w:startOverride w:val=“1”/>
</w:lvlOverride>

within the wordml.

Also bulleted lists and numbered lists don’t appear with that wordml. Can you also see why that is as it appears correctly when I open the file in Microsoft Word.

Thanks

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

It seems that problem is in the following xml snippet.

<w:p xmlns:wsp="http://schemas.microsoft.com/office/word/2003/wordml/sp2">

<w:listPr>

<w:ilvl w:val="0" />

<w:ilfo w:val="11" />

</w:listPr>

<w:pPr>Practical Creativity, Objective Analytical Power, External Orientation, Entrepreneurial drive,</w:pPr>

<w:r>

<w:rPr>Practical Creativity, Objective Analytical Power, External Orientation, Entrepreneurial drive,</w:rPr>

<w:t>Practical Creativity, Objective Analytical Power, External

Orientation, Entrepreneurial drive,</w:t>

</w:r>

</w:p>

I tried to change it and got the following.

<w:p xmlns:wsp="http://schemas.microsoft.com/office/word/2003/wordml/sp2">

<w:pPr>

<w:listPr>

<w:ilvl w:val="0" />

<w:ilfo w:val="11" />

</w:listPr>

</w:pPr>

<w:r>

<w:t>Practical Creativity, Objective Analytical Power, External Orientation, Entrepreneurial drive,</w:t>

</w:r>

</w:p>

Please try it out and let me know if this helps.

Best regards.

Hi I don’t know how that got into the wordml but have removed it and am still getting an error.

The main issue we have is that ordered lists or unordered lists apear without the formatting

I’ve attached another file with the offending <w:pPr> tag removed

Can I view the defect infomation via your bug database?

Thanks for your help.

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. You also should change the following snippet (as you mentioned).

<w:lvlOverride>

<w:startOverride w:val="1" />

</w:lvlOverride>

To

<w:lvlOverride w:ilvl="0">

<w:startOverride w:val="1" />

</w:lvlOverride>

Unfortunately this issue is still unresolved. I will notify you as soon as it is done.

Best regards.

The issues you have found earlier (filed as 4713 and 4722) have been fixed in this update.

regarding issue 4722: Fixed list formatting reading. But indents are still wrong. The document is strange, MS Word shows text using the Indented style, but can't see why. Not going to fix further.