Replies: 1   Views: 1181
Html table with colspans
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  · 14-06-2021 - 15:28


Your username doesn't a license tied. Please send to contact[at] the username or email that purchased the license.

About your question, MS Word can handle many automatic values when adding tables, but some cases such as the one you have posted, requires setting widths (the table itself and at least the first row) instead of automatic values, so MS Word can display the table correctly. Please check the following sample after changing your code:

$docx = new CreateDocx();

$html = '<table width="600">
<th width="150">AAAAA</th>
<th width="150">BBBBB</th>
<th width="150">CCCCC</th>
<th width="150">DDDDD</th>
<td colspan="3">111111</td>
<td colspan="3">222222</td>



Following this recommendation, all your tables will be displayed correctly.