Replies: 2   Views: 275
Using colspan makes last column disappear
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  · 29-12-2021 - 07:50


MS Word can handle a limited number of columns with automatic widths. As general recommendation ( when importing HTML with tables, please set the cell widths of at least the first row, and they will appear correctly in all DOCX readers. For example using width attributes:

$html = '
   <tr><td width="100">1</td><td width="100">2</td><td width="100">3</td><td width="100">4</td><td width="100">5</td></tr>
   <tr><td>6</td><td colspan="3">7</td><td>8</td></tr>


Or CSS styles:

$html = '
table tr:first-child td {
    width: 50px;
   <tr><td>6</td><td colspan="3">7</td><td>8</td></tr>