I wish to add text in various colours to a table cell. So I define a table cell:
$cell=$WORD_table->addCell(9637,array('gridSpan' => 5));
And then in a loop do:
where the colour changes according to some properties of the item I am adding. This works well EXCEPT that each item of text then appears as a new paragraph in the table cell, and I want then all to be in a single table cell.
So I did the following after the creation of $cell:
$textrun = $cell->createTextRun();
and then replaced the $cell->addText by $textrun->addText. This works well and is not covered in the documentation, so I just thought I would share this in case anyone has a similar problem!