I am getting System.FormatException in some cases

Hi,

In some cases i am getting the following exception. May i know when this will happen and what is the solution for that.

Regards,

I.Prabhaharan.

Exception: System.FormatException
Message: Input string was not in a correct format.
Source: mscorlib
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 ?.?.?(? ?)
at ?.?.?(? ?)
at ?.?.?(? ?)
at Aspose.Words.DocumentBuilder.InsertHtml(String html)

That is a known problem with unsupported measurement units in HTML import. Only pounts (pt) of all measurement units are supported now. This problem is already logged to our defect base. We will try fix it in the next hotfix which will be published in the end of August.

Meanwhile, as a workaround, you can substitute unsupported measurement units with points in your code before doing InsertHtml. That could be done using regular expressions for example.

Best regards,

Hi,

Thanks for reply. Could you please provide a sample using which i can achieve the same. And may i know if there is any other case which can cause the same kind of error?

Thanks,

I.Prabhaharan.

From what I have seen most of HTML snippets that cause the problem are containing zero-numbered values with unsupported units, like 0in or 0cm or 0px. If it is the case then you can do pretty well with the simple string replacement like

insertedHtmlString = insertedHtmlString.Replace("0in","0pt");

If the values are non-zero than the task will be trickier then that. In that case please send me a representative set of your Html snippets. I will try to compose a workaround, based on them.

Concerning your second question, to make sure that the error you reported is actually caused by unsupported measurement units issue please attach html snippet that causes the error. I will test and verify the true cause of the error.

Best regards,