Forum


Replies: 11   Views: 3225
Change data chart from xlsx
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 Red Nacional de Refugios  · 22-11-2017 - 04:57

i try to make  the example about replace data chart my code, the docx file is in folder of the example, i only moved it file in my storage

$docxx = new DocxUtilities();
        $source = storage_path('reporteword2017/example_area_chart.docx');
        $target = storage_path('reporteword2017/example_area_chartt.docx');
        $data = array();
        $data[0] = array(
            'title' => 'New title',
            'legends' => array(
                'new legend',
            ),
            'categories' => array(
                'cat 1',
                'cat 2',
                'cat 3',
                'cat 4',
            ),
            'values' => array(
                array(25),
                array(20),
                array(15),
                array(10)
            ),
        );
        $data[1] = array(
            'title' => 'Other title',
            'legends' => array(
                'legend 1',
                'legend 2',
                'legend 3',
            ),
            'categories' => array(
                'other cat 1',
                'other cat 2',
                'other cat 3',
                'other cat 4',
            ),
            'values' => array(
                array(25, 10, 5),
                array(20, 5, 4),
                array(15, 0, 3),
                array(10, 15, 2),
            ),
        );
    
        $docxx->replaceChartData($source, $target, $data);