Forum


Replies: 5   Views: 2763
Issue with addtext(..) in addlist() item
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 admin  · 28-03-2017 - 18:20

Hello,

You need to use a multidimensional array:

$textData->addText(array(array('text' => $bullet['text']['data'], 'underline' => 'single')));

Or a string:

$textData->addText($bullet['text']['data'], array('underline' => 'single'));

But not a single array as you are using to add text to the WordFragment. A multidimensional array is needed to be able to add texts with different properties:

$textData->addText(
  array(
    array('text' => $bullet['text']['data'], 'underline' => 'single'),
    array('text' => ' Other text', 'bold' => true),
  )
);

Regards.