Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Units in CSS are not correct in docx (cm, mm, in) #68

Open
achimmihca opened this issue Jan 7, 2021 · 1 comment
Open

Units in CSS are not correct in docx (cm, mm, in) #68

achimmihca opened this issue Jan 7, 2021 · 1 comment

Comments

@achimmihca
Copy link

Consider the following table, where the cell should have 10cm width:

<table>
    <tr>
        <td style="width: 10cm; background-color: #ff0000">1</td>
    </tr>
</table>

In the resulting docx, the cell has about 14cm width.

The size is consistent with other units. So "100mm" will also give this result.
The width for "1in" seems also not correct in the docx file.

I guess there is a general issue with the transformation from CSS-unit to docx-unit.

docx4j has UnitsOfMeasurement.java which might be a good starting point for finding the correct calculation.

@isedoykin
Copy link
Contributor

Any news for this? It seems units are not correct for images as well. For example, style for images: height: 100mm; width: 100mm;
In the resulting docx, the image has about 170mm width and height.

What is the transformation from CSS-unit to docx-unit in docx4j used?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants