Forum


Replies: 1   Views: 4245
How insert line break into table
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 FCNET  · 06-09-2016 - 12:19

Hello,

I'm building data table with addTable function. The number of cols and rows should be dynamic. 

I want add line break in cell but it doesn't work.

I'm trying this :

$docx = new CreateDocxFromTemplate('word/myTemplate.docx');

$wf = new WordFragment($docx, 'document');

$valuesTable = array(
        array('Axe', 'Action'),
    array("test \n sddf \r\n ".chr(13)." __LINEBREAK__ df", 'test')
);

$paramsTable = array(
                'tableStyle' => "Grilleclaire-Accent1"
        );

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

$docx->replaceVariableByWordFragment(array('TABLEAU_OBJECTIFS' => $wf), array('type' => 'block'));

$docx->createDocx($fic); 

Is it possible ? What is the good function for this ?

Thanks