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

Free Support Forum - aspose.com

Problem using css style in InsertHtml()

I have style tags within un-ordered lists (ie.

  • etc.) that I am injecting into the InsertHtml() method on the DocumentBuilder class.

    The styles are lost when rendered in Word. Is there some way I can get around this? As I have read that other people on the forum have also had problems with css styles within html tags.

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

Thank you for your inquiry.

Styles on UL and OL nodes are restricted in our HTML import. If you are applying paragraph properties they should be on P or H1…H6 nodes. Font properties are normally applied to SPAN nodes. You can attach a small fragment here and I’ll show you how it can be refactored. We know these restrictions are not good and plan to improve our HTML import in the future.

Regards,

Hi,

Basically I am inserting some Html similar to this:

  • First List 1
  • First List 2
    • Second Line 1
    • Second Line 2

Thanks in advance for some advice on how to refactor this using paragraph styles.

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

Thank you for your clarification. Basically there are simple considerations:

1. list-style, list-style-type, list-style-image, list-style-position attributes are not supported on import. (Only one of them, namely list-style-image, is exported but without roundtrip.)

2. Instead list-style-type in style you can use separate attribute type. For instance, type=”disc”.

3. To make a list numbered with lowercase-roman you should switch from UL to OL and type=”a”.

4. padding is well supported on LI.

  • First List 1
  • First List 2
    • Second Line 1
    • Second Line 2
    • Best regards,