Unsupported Size Types In InsertHTML


We're using the InsertHTML method to import html that is generated using a WYSIWYG editor on the Internet. This works fine if users just use the editor, but often they paste in HTML from Word itself, which adds all sorts of extra junk that does nothing in an actual browser or in import to a word document using Aspose.Words. This is fine, and is what I would expect.

The problem is that often word adds in extra style properties saying that margins are 0in in size (where they would be anyway), or that line spacing is .5in high (which again is irrelevant), and other things of this nature. I know that inches units are not supported by Aspose.Words, and at the present time I don't care about support for that.

The problem is that the InsertHTML method throws an error whenever it encounters these inches. I would prefer to have it just skip over the formatting, as it does with all other stuff it does not recognize. I realize that changing such functionality might impact other customers, so I have a suggestion: add an IgnoreHTMLImportErrors boolean property on DocumentBuilder, which is false by default, and which will allow the parser to just skip this and any other showstoppers that it encounters.

This would really help me out a lot, and unfortunately users did not start having this problem until we already moved our code to production (several weeks of pre-release testing by users did not catch this, somehow). I've got some users really waiting on a fix for this, as they don't know enough about html to go in and change the formatting themselves. Is there any way this could be added as a hotfix? It seems like this would be a very quick solution.

Example error is below:

System.FormatException: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt) at System.Double.Parse(String s, NumberStyles style, NumberFormatInfo info) at ӓ.ө.ӵ(String ӝ) at ӓ.ө.set_Ӕ(String ӝ) at ӓ.Ә.set_Ӕ(String ӝ) at ᛼.᛻.ᜀ(String ᛾, ParagraphFormat ᜁ) at ᛒ.ᛑ.ᛮ(ۭ ہ) at ᛒ.ᛑ.᛫(ۭ ہ, Boolean ᛣ) at ᛒ.ᛑ.ᛤ(ۭ ہ, Boolean ᛣ) at ᛒ.ᛑ.ᛢ(ۭ ہ, Boolean ᛣ) at ᛒ.ᛑ.ᛟ(ۭ ہ) at ᛒ.ᛑ.ᛟ(ۭ ہ) at ᛒ.ᛑ.ᛟ(ۭ ہ) at ᛒ.ᛑ.ᛠ(پ ᛡ) at Aspose.Words.DocumentBuilder.InsertHtml(String html) at StartaServices.Services.ReportService.WriteWordData(DocumentBuilder builder, String col, String mod, Object data, String errorText, String Module)



Thanks for your suggestion. It looks very reasonable to me. I will discuss it with the rest of the team and let you know if we are going to implement it in the next release.

Best regards,


Thanks for your reply. I'll be very interested to know when this can be implemented, because, as I said, I have some customers who are very interested in that change to the functionality (insofar as it affects their Word exports). Please let me know.