Forum


Replies: 5   Views: 1496
Extra space printed before the replaced variable with "replacevariablebyhtml"
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 Bouillou  · 01-10-2020 - 14:54

Dear support,

With version 9, replacing variable with "replaceVariableByHTML" displays an extra space before the text.

You can see the problem with this simple code :

<?php

require_once '../../../Classes/Phpdocx/Create/CreateDocx.php';

$docx = new Phpdocx\Create\CreateDocxFromTemplate('../../files/TemplateHTML.docx');

$docx->replaceVariableByHTML('CHUNK_1', 'block', "<- Should not have a space before thhis text<br />End of the text");
$docx->replaceVariableByHTML('CHUNK_2', 'inline', "<- Should not have a space before thhis text<br />End of the text");

$docx->createDocx('MyTestDoc');

Do you know how to fix this?

Best regards