I was trying to run the following code from tutorial:
require_once '../phpdocx_community/classes/CreateDocx.inc';
$docx = new CreateDocx();
$text = array();
$text[] =
array(
'text' => 'I am going to write'
);
$text[] =
array(
'text' => ' Hello World!',
'b' => 'on'
);
$text[] =
array(
'text' => ' using bold characters.'
);
$docx->addText($text);
$docx->createDocx('../word_documents/hello_world_2');
?>
and ran into the following error:
Warning: htmlspecialchars() expects parameter 1 to be string, array given in C:\xampp\htdocs\phpdocx_community\classes\CreateText.inc on line 576
It looks like the function addText is unable to use $text as an input argument since it is an array. Did anyone run into this issue? I tried to convert the array into a string by using implode method but it didn't print the value as expected. Instead, it simply printed "ArrayArrayArray".
Please advise.
Thanks,
Kamal