Reputation: 47172
I'm soon tearing my hair off but I'm really struggling with how docx4j interprets CSS when converting xhtml to a docx-file.
I've tried googling and I keep getting back to reading the sourcecode for the entire project in order to figure ut out.
For example I found out that font-sizes are only interpreted when in pt
and not in px, em
or any of the other sizes. And that by reading this link
Also, if anyone could be so kind as to help me with font-face
which just doesn't seem to work.
Is there anyone out here that can explain how or has any documentation as to how it works?
Upvotes: 2
Views: 1695
Reputation: 15863
*Disclosure: I wrote the relevant docx4j code *
There are two parts to it.
The first is Flying Saucer / XHTML Renderer.
The second is the code in docx4j which converts what it gets from Flying Saucer to WordML.
As you've discovered, there are some things which docx4j doesn't convert yet (font face being one of them). Not because they are particularly hard, but just because our priorities have been elsewhere. You are welcome to add whatever you need and contribute a patch.
For simple stuff like you mention, the starting point is the addRunProperties method at line 1327 of XHTMLImporter. There you can see the CSSValue objects provided by Flying Saucer. I presume you've found the docx4j source code on GitHub.
Upvotes: 4