Exception raised by InsertHTML: Input string was not in a correct format

We received the following error info after inserting some HTML:

The error description is as follows : Input string was not in a correct format.
Method: Double ParseDouble(System.String, System.Globalization.NumberStyles, System.Globalization.NumberFormatInfo)
Client Browser: IE 6.0
Client Url: https://www.scoreandreport.com/rptpreviewdl.aspx
Client IP: 172.129.218.34
Stack: at System.Number.ParseDouble(String s, NumberStyles style, NumberFormatInfo info)
at System.Double.Parse(String s, NumberStyles style, IFormatProvider provider)
at ?.?.?(String ?)
at ?.?.set_?(String ?)
at ?.?.set_?(String ?)
at ?.?.?(String ?, ParagraphFormat ?)
at ?.?.?(? ?)
at ?.?.?(? ?, Boolean ?)
at ?.?.?(? ?, Boolean ?)
at ?.?.?(? ?, Boolean ?)
at ?.?.ProcessNode(? node)
at ?.?.ProcessNode(? node)
at ?.?.?(? ?)
at Aspose.Word.DocumentBuilder.InsertHtml(String html)

The HTML that caused the error:

<br /><p class=\"MsoNormal\" style=\"MARGIN: 0in 0in 0pt\">Caiden A. is a 15 month old, male child who lives with his biological mother and father. </p><p class=\"MsoNormal\" style=\"MARGIN: 0in 0in 0pt\">Caiden&#8217;s father, Mr. A, is 33 years old and employed as a training manager for a chiropractic company.<span style=\"mso-spacerun: yes\">&#160; </span>His mother, Mrs. A, is a registered nurse who is employed by a Legal firm which deals in medical malpractice.<span style=\"mso-spacerun: yes\">&#160; </span></p><p class=\"MsoNormal\" style=\"MARGIN: 0in 0in 0pt; tab-stops: 111.75pt\"><span style=\"mso-tab-count: 1\">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></p><p class=\"MsoNormal\" style=\"MARGIN: 0in 0in 0pt\">Caiden&#8217;s father has a son from a previous marriage, Julian, who is 16 years old.<span style=\"mso-spacerun: yes\">&#160; </span>Julian is currently living at a boarding school in <?xml :namespace prefix=st1 ns=\"urn:schemas-microsoft-com:office:smarttags\" /?><st1:state xmlns:st1=\"<a target="_blank" title="" href=""><st1:place>Oregon</st1:place></st1:state'>http://unknownprefix/st1\"><st1:place>Oregon</st1:place></st1:state</a>> and only comes home during holidays, at which time he stays part-time with his biological father and part-time with his biological mother who lives nearby.<span style=\"mso-spacerun: yes\">&#160; </span>This is Caiden&#8217;s only sibling.</p><p class=\"MsoNormal\" style=\"MARGIN: 0in 0in 0pt\"><?xml :namespace prefix=o ns=\"urn:schemas-microsoft-com:office:office\" /?>&#160;</p><p'>http://unknownprefix/o\">&#160;</p><p</a> class=\"MsoNormal\" style=\"MARGIN: 0in 0in 0pt\">According to Mrs. A, this was a planned pregnancy and was her first.<span style=\"mso-spacerun: yes\">&#160; </span>There were no complications during the pregnancy with the exception of the development of gestational diabetes, which was controlled by diet and exercise. Mrs. A reports she was taking thyroid medication for a hypothyroid condition during the pregnancy as instructed by her physician.<span style=\"mso-spacerun: yes\">&#160; </span>The only complication related to the birth was a failure to dilate which required Pitocin, a medication which aids in dilation and contraction.<span style=\"mso-spacerun: yes\">&#160; </span>The medication failed to work and the baby was then physically extracted by a midwife.<span style=\"mso-spacerun: yes\">&#160; </span>Labor was 36 hours.</p><p class=\"MsoNormal\" style=\"MARGIN: 0in 0in 0pt\">&#160;</p><p class=\"MsoNormal\" style=\"MARGIN: 0in 0in 0pt\">At the time of this observation Caiden weighed 23lbs and was 29 inches long.<b style=\"mso-bidi-font-weight: normal\"></b></p><p'>http://unknownprefix/o\"></b></p><p</a> class=\"MsoNormal\" style=\"MARGIN: 0in 0in 0pt\">No physical abnormalities were observed and his mother reports that he has met all developmental milestones so far.</p><p'>http://unknownprefix/o\"></p><p</a> class=\"MsoNormal\" style=\"MARGIN: 0in 0in 0pt\"><b style=\"mso-bidi-font-weight: normal\">&#160;</b></p'>http://unknownprefix/o\">&#160;</b></p</a>><br /><br /><strong>However,  this similar HTML worked fine:<br /></strong><p class=\"\">Caiden A. is a 15 month old, male child who lives with his biological mother and father. </p><p class=\"\">Caiden&#8217;s father, Mr. A, is 33 years old and employed as a training manager for a chiropractic company.&#160; His mother, Mrs. A, is a registered nurse who is employed by a Legal firm which deals in medical malpractice.&#160; </p><p class=\"\">Caiden&#8217;s father has a son from a previous marriage, Julian, who is 16 years old.&#160; Julian is currently living at a boarding school in <?xml :namespace prefix=st1 ns=\"urn:schemas-microsoft-com:office:smarttags\" /?><st1:state class=\"\" st1=\"<a target="_blank" title="http://unknownprefix/st1\" href="http://unknownprefix/st1\">http://unknownprefix/st1\</a>" xmlns:st1=\"<a target="_blank" title="" href=""><st1:place'>http://unknownprefix/st1\"><st1:place</a> class=\"\">Oregon</st1:place></st1:state> and only comes home during holidays, at which time he stays part-time with his biological father and part-time with his biological mother who lives nearby.&#160; This is Caiden&#8217;s only sibling.</p><p class=\"\"><?xml :namespace prefix=o ns=\"urn:schemas-microsoft-com:office:office\" /?>http://unknownprefix/o\</a>" xmlns:o=\"<a target="_blank" title="" href="">&#160;According'>http://unknownprefix/o\">&#160;According</a> to Mrs. A, this was a planned pregnancy and was her first.&#160; There were no complications during the pregnancy with the exception of the development of gestational diabetes, which was controlled by diet and exercise. Mrs. A reports she was taking thyroid medication for a hypothyroid condition during the pregnancy as instructed by her physician.&#160; The only complication related to the birth was a failure to dilate which required Pitocin, a medication which aids in dilation and contraction.&#160; The medication failed to work and the baby was then physically extracted by a midwife.&#160; Labor was 36 hours.</p><p class=\"\">At the time of this observation Caiden weighed 23lbs and was 29 inches long.http://unknownprefix/o\</a>" xmlns:o=\"<a target="_blank" title="" href=""></p><p'>http://unknownprefix/o\"></p><p</a> class=\"\">No physical abnormalities were observed and his mother reports that he has met all developmental milestones so far.http://unknownprefix/o\</a>" xmlns:o=\"<a target="_blank" title="" href="">&#160;</p'>http://unknownprefix/o\">&#160;</p</a>><br /><br /><strong>I think it has to do with the style margins?</strong><br /></font></p>

Hi,

Thank you for your interest in Aspose.Word.

Yes, it seems like you are right because style element isn’t supported at all.

Instead of raising an exception, can Aspose.Word ignore unsupported elements? Or should the server strip out unsupported tags?

We have logged your request, thank you. We will surely notify you as soon as fix this.

Can you please attach the above HTML fragment as a file instead of posting. I think it got garbled after posting (slashes were inserted, maybe something else).

Our CSS parsing is limited at the moment, but I should be able to make sure it does not throw if I have the file you are having problem with.

Just got back from vacation… that would be great if exceptions weren’t thrown if something was not supported like paragraph styles. I’ve attached the html.

Try using the latest version of Aspose.Word as it does not throw an exception for me. Attached is the document I was able to import.

I am currently using 2.3. Also, we don’t insert HTML via files, we are pulling the HTML out of the database and something must have changed when I pasted into a file to attach.

Ok, the attached file throws an exception when InsertHTML is used. BTW, I use the InsertHTML method that accept an HTML string, not a filename.

Yes, this actually causes an exception. Thank you, we’ll look into it.

I noticed v2.4 came out and hasn’t resolved this issue. Any ETA on the fix?

Sorry, no comments for any estimated time.

Hey I noticed a new version came out today. I need to know if this bug is scheduled to be fixed so I can plan my product accordingly.

Sorry, no progress for this issue yet.

Has this issue been resolved yet?

Sorry, but these are not defects that we will be fixing immediately. Please understand it is the current set of features supported by HTML import and export in Aspose.Word.

We will be extending HTML import functionality in the future.

Pay attention to the following message “…inline CSS styles are supported, but support is limited to consuming Aspose.Word generated HTML files”.

We use an HTML editor to allow users to add formatted paragraphs to a word document. Using InsertHTML raises exceptions for unsupported tags and elements such as paragraph styles. This exception handling policy with Aspose.Word forces us to strip out all formatting and simply append the text.

Couldn’t Aspose.Word take a more friendly approach to HTML similar to how current internet browsers deal with HTML? In other words, can Aspose.Word simply ignore unsupported HTML formatting and insert the HTML it does understand? This would help our users tremendously.

We will do exactly that. Sorry still didn’t have time to do this work on HTML import yet. Although we are significantly improving how HTML tables are imported right now.

Great news! I’ve been waiting for this one for about 8 months now. Thank you Roman!

I downloaded v3.3.2.0 and it looks like InsertHTML is working and any unsupported HTML tags/attributes are ignored. However, the exception is still raised, which is fine as long as that’s the expected behavior. Can you verify that this is the expected behavior?