Forum


Replies: 2   Views: 3446
Template variable - insert multi-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 benoit.quentin-tr@sncf.fr  · 25-03-2014 - 19:12

Hi,



I try to insert few lines of text in a Template Docx.

In my template, I wrote this :



Pièces jointes :    $piecesjointes$



I try to do that :



Pièces jointes :    - First

                         - Second



-----

I do that in my code :



$valeur = '- First<w:br/>- Second';

$valeur = explode("<w:br/>", $valeur);

$PHPDocx->addTemplateVariable('piecesjointes', $valeur);



-----

The results is not exactly as expected :



____



Pièces jointes : - First

Pièces jointes : - Second

Pièces jointes :



____



"Pièces jointes" is repeated and a new line is added ...



How can I do it properly ?


Posted by jorgelj  · 26-03-2014 - 09:21

Hello,



You can use replaceTemplateVariableByHTML to replace the placeholder adding '<br>' to do the line breaks.



Regards.