Replies: 8   Views: 4942
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  · 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.


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

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

Is there any way to get this done?

Regards, R.