Forum


Replies: 3   Views: 3201
How to put line break in chars when generate table lines
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 Patrick  · 16-01-2013 - 14:45

Hi, I encountered a problem when I was trying to generate a table row where in each cell I need a line break in a string.

For example, if I put the codes in the following, the strings 'first line' and 'second line' are still in the same line.

[code]require_once '../../classes/CreateDocx.inc';

$docx = new CreateDocx();

$valuesTable = array(
array(
'first line \\r\\n second line', // \\r\\n doesn't work in the generated table !
12
),
array(
21,
22
),
);

$paramsTable = array(
'border' => 'single',
'border_sz' => 20
);


$docx->addTable($valuesTable, $paramsTable);

$docx->createDocx('example_table');[/code]

Is there any way to make them into two lines? Thanks.

Posted by pphornet  · 11-04-2013 - 12:13

Hello,
much greater opportunities of using html with $ docx-> embedHTML

I hope it is useful for you.

Posted by admin  · 11-04-2013 - 12:13

Hello,

That's right, we recommend you to used embedHTML.

Regards.