PHPOffice / PHPWord

A pure PHP library for reading and writing word processing documents
https://phpoffice.github.io/PHPWord/
Other
7.25k stars 2.69k forks source link

Fatal error: Uncaught Error: Call to undefined method PhpOffice\PhpWord\TemplateProcessor::setChartValue() #2224

Open cyrillethierry opened 2 years ago

cyrillethierry commented 2 years ago

Describe the Bug

The method setChartValue() is undefined

Steps to Reproduce

Using this from documentation : source : [https://phpword.readthedocs.io/en/latest/templates-processing.html]

$templateProcessor- = new \PhpOffice\PhpWord\TemplateProcessor("mytemplate.docx');

$categories = array('A', 'B', 'C', 'D', 'E'); $series1 = array(1, 3, 2, 5, 4); $chart = new Chart('doughnut', $categories, $series1); $templateProcessor->setChartValue('myChart', $chart); $templateProcessor->save();

Expected Behavior

I expect a graph to appear in replacement of ${myChart} into the template

Current Behavior

Fatal error: Uncaught Error: Call to undefined method PhpOffice\PhpWord\TemplateProcessor::setChartValue()

Context

Please fill in your environment information:

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue for you, please try to help by debugging it further and sharing your results. Thank you for your contributions.

lluisgustavo commented 1 year ago

I know I'm late, but it works for me on version 1.0.0 with $templateProcessor->setChart('myChart', $chart);