We are using a lot of tables in our WORD-Documents. The Documents are created using DOCX4J and immediately after creating they are converted to HTML (using the code from the samples).
All tables used are Setup with "preferred width = 100%" and the size of the columns is calculated at runtime and also Setup as pct (percentage). Here is the tblpr for the complete table:
- Code: Select all
TblWidth tblwidth = objectFactory.createTblWidth();
tblwidth.setW( BigInteger.valueOf( 5000) ); // 5000 = 100%
tblwidth.setType("pct");
tblpr.setTblW(tblwidth);
And here is the tcpr for the columns:
- Code: Select all
TblWidth tblwidth = objectFactory.createTblWidth();
tcpr.setTcW(tblwidth);
tblwidth.setW(BigInteger.valueOf(Integer.parseInt(sizeColumns[j])));
tblwidth.setType( "pct");
After converting the document to HTML, the width of the columns is correct but the width of the complete table is either set to absolute values "3.47in" or "6.74in" (depending on if it is nested or not). I first assumed that there is a Limitation in HTML to have absolute values for Table-Widths, but that does not seem to be true.
Any ideas why docx4j changes the relative values of the table width to absolute values? Is this a correct behaviour?
Thanks