Forum


Replies: 3   Views: 2602
Libreoffice conversion - table columns width
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by admin  · 10-07-2019 - 16:12

Hello,

We have tested your HTML with the colspan value using the previous changes and it works correctly as well with MS Word and LibreOffice.

Please note that the code you have posted:

<table width="600">
<tr>
<td coldspan="2" width="100"></td> <!-- or width="600" is equal...-->
</tr>
<tr>
<td width="100"></td>
<td width="500"></td>
</tr>
</table>

isn't correct. It should be:

<table width="600">
<tr>
<td colspan="2" width="100"></td> <!-- or width="600" is equal...-->
</tr>
<tr>
<td width="100"></td>
<td width="500"></td>
</tr>
</table>

This is using colspan (not coldspan). You can use an auto value, or 100 or 600 as width in the td.

We have tested it using the following code:

$html = '
<table border="1" width="600">
<tr>
<td colspan="2" width="100">A</td>
</tr>
<tr>
<td width="100">B</td>
<td width="500">C</td>
</tr>
</table>';

$docx->embedHTML($html);

Regards.