0

My requirement is to display charts present in MS Office excel 2007.

I was looking into PHP-ExcelReader but didn't get any help.

Can someone please help me getting it right by PHP?

Note: I have more than 1 chart in all sheets inside a single excel sheet.

P K
  • 9,972
  • 12
  • 53
  • 99

2 Answers2

1

yes PHP-ExcelReader supports Excel charts read/write and display by PHP, you can use below code to do this :-

error_reporting(E_ALL);
date_default_timezone_set('Europe/London');
require_once '../Classes/PHPExcel/IOFactory.php';
require_once '../Classes/PHPExcel.php';
$excel2 = PHPExcel_IOFactory::createReader('Excel2007');

/*Enable chart read on excel*/
$excel2->setIncludeCharts(TRUE);
/*Enable chart read on excel*/

$excel2 = $excel2->load('excelname.xlsx'); // Empty Sheet

/*update cell data if you required */
$excel2->getActiveSheet()->setCellValue('B6', '2');
$excel2->getActiveSheet()->setCellValue('B7', '1');
$excel2->getActiveSheet()->setCellValue('B8', '3');
/*-----------------------------*/

$objWriter = PHPExcel_IOFactory::createWriter($excel2, 'Excel2007');
/*Enable chart write on excel*/
$objWriter->setIncludeCharts(TRUE);
/*Enable chart write on excel*/
$objWriter->save('excelout.xlsx');
Nilesh Chourasia
  • 408
  • 4
  • 11
0

I would check out the links in this question. They should give you the information you need.

Also, this question, it is almost identical to yours.

Check out this article too.

Community
  • 1
  • 1