Forum


Replies: 2   Views: 2011
Table cell starts with empty line
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  · 04-12-2019 - 13:09

Hello,

We recommend you to wrap that content using a HTML tag (such as a paragraph or a span tag), for example:

$docx->embedHTML('
    <table>
        <tr>
            <td><br><p>First cell</p></td>
            <td>Second cell</td>
            <td>Third cell</td>
        </tr>
        <tr>
            <td>2.1 cell</td>
            <td>2.2 cell</td>
            <td>2.3 cell</td>
        </tr>
    </table>
');

Or use the removeLineBreaks option:

$docx->embedHTML('
    <table>
        <tr>
            <td><br>First cell</td>
            <td>Second cell</td>
            <td>Third cell</td>
        </tr>
        <tr>
            <td>2.1 cell</td>
            <td>2.2 cell</td>
            <td>2.3 cell</td>
        </tr>
    </table>
', array('removeLineBreaks' => true));

to clean extra line breaks that may be generated by PHP Tidy.

Regards.