Replies: 3   Views: 3334
Line break in table cell
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 boilingsnail  · 08-10-2011 - 07:35

How would you fill a table cell with two *lines* of text ?

Put another way, how would you get two short paragraphs inside one table cell?

Thanx in advance

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


You need to add a CreateText object and add it into the table; please check intermediate/Table.php example included on phpdocx pro.

To do a break in a paragraph use an array of strings.

Regards. Jorge.

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

Could use some help with this line break in a table cell. When you mention an array of strings, I insert an array of strings in the addElement. The array for this is:

array (
0 =>
array (
'font' => 'Courier',
'sz' => '8',
'text' =>
array (
0 => '1.While executing ASR failover high availability test',
1 => '2.On phone in Test Cluster 1 place call to phone on Test Cluster 2',
2 => '3.Verify leave/retrieval of Voice Mail',
3 => '4.On phone in Test Cluster 3 place call to phone on Test Cluster 1',
4 => '5.Verify leave/retrieval of Voice Mail',
5 => '6.On PSTN cluster place call to phone in Test Cluster 1',
6 => '7.Verify leave/retrieval of Voice Mail',

Then I add it to the table array:

$table[]=array($docx->addElement('addText', $headerStyle),$docx->addElement('addText',$courierParagraph));

That returns a blank entry in the table. If I replace the 'text' with just a string it works. So I know that is working. But the array of strings doesn't seem to work. I am using the PRO version.