Forum


Replies: 8   Views: 7031
Setting fixed width to first column in an html table
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  · 21-12-2017 - 11:40

Hello,

If you don't set a fixed width value then the table grows to fit the content.

Please set widths for all cols of the first row:

$html = '<table>
            <tbody>
                <tr>
                    <td width="180">FY 1</td>
                    <td width="180">FY 2</td>
                    <td width="180">FY 3</td>
                    <td width="180">FY 4</td>
                    <td width="100">FY 5</td>
                </tr>
                <tr>
                    <td>Content A1</td>
                    <td>Content A2</td>
                    <td>Content A3</td>
                    <td>Content A4</td>
                    <td>Content A5</td>
                </tr>

Regards.