Forum


Replies: 1   Views: 3145
<td> height not working
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 coolaustralia  · 20-08-2018 - 10:25

I have the following HTML:

<table style="width: 686px;" border="1"><tbody><tr><td style="width: 351px;height: 120px;">One thing presented in the clip that was surprising or interesting:</td>
<td style="width: 321px;height: 120px;"></td>
</tr><tr><td style="width: 351px;height: 120px;">One thing I didn’t understand:</td>
<td style="width: 321px;height: 120px;"></td>
</tr><tr><td style="width: 351px;height: 120px;">Any vocabulary that I want to know:</td>
<td style="width: 321px;height: 120px;"></td>
</tr><tr><td style="width: 351px;height: 120px;">One thing that reminded me of something that I already know:</td>
<td style="width: 321px;height: 120px;"></td>
</tr></tbody></table>

Unfortunately, the resulting Word document has the <td> height set by the content instead of the specified values. I can confirm that viewing the HTML shows the sizing correctly. 

Posted by admin  · 20-08-2018 - 12:05

Hello,

MS Word allows setting height to rows (tr), not to cells. You can check it opening MS Word, adding a table and then changing the properties.

phpdocx supports setting height to rows as well, you just need to add the height property to the row. The library adds this property using "atLeast" values; if you need to set "exact" values, please use the addTable method or DOCXCustomizer. You can also customize the generateTrPr method in HTML2WordML.php.

Since the release of phpdocx 9.5, the easiest approach to accomplish this task is using HTML Extended.

Regards.