DocumentBuilder insertHtml method supported CSS

Hello,
I am looking for a webpage that has all the supported CSS properties when using the DocumentBuilder.insertHtml method. I found it before, but for some reason I cannot find it anymore.

It had a table of CSS properties, whether they were supported or not, and what Word property it converted to. It was really helpful. If you have this documentation for both Word and PDF that would be great. Thank you.

@martincoty77

Yes, DocumentBuilder.insertHtml does support CSS. Please make sure that the CSS is included in the HTML string.

Please read the following article for more detail.
https://docs.aspose.com/words/java/use-documentbuilder-to-insert-document-elements/#inserting-html

I think, you are looking for following documentation page. Please let us know if you have any more queries.
https://docs.aspose.com/words/java/style-features-supported-on-html-import/

Thanks! The HTML Import page was what I was looking for.
Two other question that I am struggling with.

First, what is the most compatible unit of measurement for width and height? px/em/% etc?

Second, is how to align HTML elements next to each other like you can in a webpage so it transfers correctly into a Word Document.

In HTML alignment can happen in several ways:

  1. tables, with rows and columns
  2. Using Float: left/roight with divs with a set width (px or percentage)
  3. Using display flex with flex-grow on the child elements - is flex supported (I didn’t see it)
  4. Display inline block?

The one thing I noticed, is that % width seems to ignore the element that it is in. For example, if you do this:

> <div style="width: 50%; background-color: red;">
>         <div style="width: 100%; background-color: green;">&nbsp;</div>
> </div>

The parent div does not contain the child div and the 100% seems to represent the entire width of the document, even including the margins. Is there a way to make it work like HTML?

Thanks for the help!

@martincoty77

Please note that Aspose.Words mimics the behavior of MS Word. If you open your HTML in MS Word and save to any other file format, you will get the same output by Aspose.Words.

The DIV is imported into paragraph tag of HTML. So, it will not imported with 50% width as in HTML document.

It looks like the “HTML Import - Style Features” link changed again!
My shortcut to this page no longer works, nor does the link above.

Where did it go?

@martincoty77 The article was outdated and we decided to remove it. We are working on actualization of our documentation and list of supported features for each format is one of subtasks of this work. Please accept our apologies for your inconvenience.