您好我刚刚加载了带图表的xlsx文件,但图表未显示在输出中。
这是我的代码:
$objPHPExcel=$objPHPExcel_new = new PHPExcel();
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objPHPExcel = $objReader->load("../Graph_sample.xlsx");
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('result.xlsx');
答案 0 :(得分:7)
由于大多数用户不希望默认加载图表(加载/保存图表是速度和内存开销),因此您必须明确告诉PHPExcel您要使用setIncludeCharts()
加载它们:
$objPHPExcel=$objPHPExcel_new = new PHPExcel();
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objReader->setIncludeCharts(TRUE);
$objPHPExcel = $objReader->load("../Graph_sample.xlsx");
写作时
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->setIncludeCharts(TRUE);
$objWriter->save('result.xlsx');