Forum


Replies: 2   Views: 1615
Unwanted space at beginning of table cell
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-07-2020 - 15:58

Hello,

We have run the following script using all versions of PHP from 5.2.11 to 7.4 and in all cases there's no extra space:

require_once 'classes/CreateDocx.php';

$docx = new CreateDocx();

$html = '
<table>
    <tbody>
    <tr>
        <td style="border-bottom:solid #000000;border-left:solid #000000;border-right:solid #000000;border-top:solid #000000;width:20%;">Test</td>
        <td style="border-bottom:solid #000000;border-left:solid #000000;border-right:solid #000000;border-top:solid #000000;width:80%;">Has extra space in front when <strong>bold</strong> is used</td>
    </tr>
    </tbody>
</table>
';
$options = array(
    'parseDivs' => 'paragraph',
    'addDefaultStyles' => true,
    'disableWrapValue' => true,
    'useHTMLExtended' => true,
    'downloadImages' => true,
    'parseFloats' => true,
    'strictWordStyles' => false,
);

$docx->embedHTML($html, $options);

$docx->createDocx('output');

Please send to contact[at]phpdocx.com the following information:

  • DOCX output that contains the extra blank space, for example the output of running the previous code on your server.
  • PHP version and phpdocx version you are using.
  • Program and version you are using to open it.

so we can check it. removeLineBreaks in phpdocx 10 should only remove extra line breaks added by Tidy but not other line breaks, maybe you are using an old version of phpdocx?

Regards.