0

XHTML:

    <span style="color:#696969;">
        <span style="font-family:tahoma;">
            <span style="font-size:8pt;">
                18F, Mirae Asset CENTER1 West Tower
            </span>
        </span>
    </span>

converted document.xml:

<w:r>
       <w:rPr>
            <w:rFonts w:ascii="Tahoma" w:hAnsi="Tahoma"/>
            <w:b w:val="false"/>
            <w:i w:val="false"/>
            <w:color w:val="696969"/>
       </w:rPr>
       <w:t>
           18F, Mirae Asset CENTER1 West Tower
       </w:t>
</w:r>

font-size:8pt; not getting converted to <w:sz w:val="8"/> in ooxml. If font-size is given as small,x-large,etc. it gets converted.

Sourav
  • 73
  • 8

1 Answers1

0

You'd expect it to get converted as w:val=16 since the measurement is in half points. https://github.com/plutext/docx4j/blob/master/docx4j-core/src/main/java/org/docx4j/model/properties/run/FontSize.java#L123

JasonPlutext
  • 15,352
  • 4
  • 44
  • 84
  • So font-size in pts gets ignored it seems. Tried using px by converting pt to px – Sourav May 07 '19 at 08:01
  • Does xhtml to docx converter reads inline CSS or external CSS files ? Was not able to get that working as well. Tried adding classes in `XhtmlNamespaceHandler.css` file, but didn't work. Renderer used is `xhtmlrenderer-3.0.0.jar` – Sourav May 07 '19 at 08:42
  • It uses FlyingSaucer, which supports both embedded and linked CSS, so if you are having issues, see for example https://stackoverflow.com/questions/25990886/external-css-in-flying-saucer – JasonPlutext May 07 '19 at 23:33