replaceChartData

replaceChartData

ADVANCED / PREMIUM BASIC

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

Description
public replaceChartData($source, $target, $chartData, $options = array())

This method allows to replace the chart data in an existing PowerPoint presentation. You may fully customize the chart via the PowerPoint before inserting the real data with the help of phppptx.

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

Parameters

source

The path to the source PPTX file.

target

The path to the PPTX file resulting after the chart replacement.

data

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

options

Key Type Description
slideNumber int Slide number to replace the chart. Default as 1 (first slide).
Code samples

Example #1

Release notes
  • phppptx 2.5: new method.