We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Words DocumentBuilder.InsertHtml badly formed css issue

Hi Aspose

I am using Aspose.Words to create a document from html that has been generated by a third party rich text control (that is most likely having MS Word html pasted into it!).

As such my html tends to be a bit of a mess.I am having a problem at the moment where I have the following html:

Tester.

The problem with this is that for some reason the font name has two apostrophe characters either side, instead of a regular quotation " character. So aspose words is throwing an invalid argument exception.

Is this something Aspose.Words could handle better? Or is this expected functionality seeing as the html I am inputting is badly formed?

Cheers

Luke

Hi
Thanks for your request. Of course this is incorrect. There should be single quotes. As shown below.
‘times new roman’">Tester.
If your rich text control returns such result then you should contact their support.
Also you can easy fix this by replacing two quotation characters with single. As shown in the following code.

string hrml = "Tester. ";
hrml = hrml.Replace("''", "'");
builder.InsertHtml(hrml);

Hope this helps.
Best regards.