Forum


Replies: 1   Views: 2133
Issue with & in the array
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  · 12-09-2017 - 15:34

Hello,

You need to use the htmlentities function when you need to add a protected character such as & or <.

For example:

$data = array(
    htmlentities('data &1') => array(20),
    'data 2' => array(20),
    'data 3' => array(50),
    'data 4' => array(25),
    'data 5' => array(5),
);

$paramsChart = array(
    'data' => $data,
    'type' => 'doughnutChart',
    'showPercent' => true,
    'explosion' => 10,
    'holeSize' => 25,
    'sizeX' => 12,
    'sizeY' => 10,
    'chartAlign' => 'center',
    'color' => '2',
    'legendPos' => 'r',
    'legendOverlay' => true,
    'showTable' => true,
);
$docx->addChart($paramsChart);

Regards.