Forum


Replies: 8   Views: 7015
Addtemplatevariable & 'table' with line breaks in table cells
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 falcana-blocked  · 08-01-2014 - 16:55

I would like to fill a table in a docx document by using addTemplateVariable with the 'table' paramenter.



Basically that works fine, but I have the problem, that the content for the cells contains line breaks "\n". I tried different ways, but I don't get the result to have the line breaks in the table cells in the docx. They are simply ignored, so all the text is in one line.



Example:




$data = array(
array(
'a' => "Line1\nLine2",
'b' => "Line1\nLine2\nLine3",
),
array(
'a' => "Line1\nLine2",
'b' => "Line1\nLine2\nLine3",
)
);

$docx->addTemplateVariable($data, 'table', array('header' => false));


Is there any way to get this done?



Regards, R.