docx4j icon indicating copy to clipboard operation
docx4j copied to clipboard

Converting xHTML to docx doesn't keep table width

Open 7amou opened this issue 1 year ago • 1 comments

When converting xhtml to word with docx4j with tables that are set with a width of 50% (for example), the doc generated do not respect this width, and the same goes for the cells. Code snippet from the html : <p>50%, border 1 et width: 50%; border-collapse: collapse; et pour chaque cellule width: 33.3333%</p> <table border="1" cellspacing="0" style="border-collapse: collapse;" width="50%"> <tbody> <tr> <td width="33.3333%">Kilométrage au sinistre</td> <td width="33.3333%">Prise en charge de l&#39;intervention au titre du Contrat</td> <td width="33.3333%">Montant restant à votre charge</td> </tr> <tr> <td width="33.3333%"></td> <td width="33.3333%"></td> <td width="33.3333%"></td> </tr> <tr> <td width="33.3333%"></td> <td width="33.3333%"></td> <td width="33.3333%"></td> </tr> </tbody> </table> The generated table : image I don't know what I am missing, everything goes well when the width is at 100% for the table tag, and I saw that the width acts like a threshold, it will generate a 100% width if the value was >50%, approximately 75% generated if the value is 50% and 50% generated for <50%. Do you know what is wrong with the way we style our tables ? Thanks

7amou avatar Sep 27 '23 15:09 7amou

Wrong project, please report instead at https://github.com/plutext/docx4j-ImportXHTML/issues

plutext avatar Feb 27 '24 00:02 plutext