Forum


Replies: 7   Views: 4114
Extra space on the beginning of every paragraph on html to doc
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 ddg  · 19-11-2018 - 18:21

I have simple templates set up, with some layout set (header, footer, margins) and one single variable to replace. However, when I replace it with HTML with the call:

$docx->replaceVariableByHTML('REPORT', 'block', $css . $html, [
            'strictWordStyles' => false,
            'parseDivsAsPs' => true
        ]);

… the generated file has a space on the beginning of every single paragraph. I set the paragraphs to have no left margin, the HTML renders like I want it to render on the browser (with no margin nor text indentation), but the generated files invariably have that space. I tried replacing <p> tags with <div>, removing potential tabs and nl characters, all for naught.  Tidy is enabled; I've checked with

extension_loaded('tidy')

… right before the file generating code, and the function returns true.

PHP 7.2.6, phpdocx 7.5.
Any help fixing this issue would be greatly appreciated, and would lead to acquiring further licenses to deploy this software to other servers. Thank you in advance!