replaceChartData

replaceChartData

ADVANCED / PREMIUM TRIAL

Replaces the data associated with a given chart (titles, categories, legends, sections and values).

Description
public replaceChartData (string $source, string $target, array $data)

This method allows to replace the chart data in an existing Word document. You may fully customize the chart via the Word interface before inserting the real data with the help of phpdocx.

The chart type to be updated must be supported by addChart.

Parameters

source

Path to the DOCX.

target

Path to the resulting DOCX.

data

The keys are the numbers of the charts to replace and the values are arrays of data as described in the addChart method.

Exceptions

Error while trying to open the (base) template as a zip file.

'The index chart does not exist..

Code samples

Example #1