PHPExcel在加载模板时删除图表样式 [英] PHPExcel removes chart style when template is loaded

查看:1235
本文介绍了PHPExcel在加载模板时删除图表样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用PHPExcel读取和写入值到Excel。我有一个有图形和样式的模板。

I am using PHPExcel to read and write values to Excel. I have a template that has a graph and a style on it.

这里是问题:
在Excel表格上添加一些值后,样式图表已删除,并显示默认样式。

Here's the issue: After I appended some value on the Excel sheet, the style of the chart has been remove and it shows the default style.

我使用此代码阅读:

$objReader = PHPExcel_IOFactory::createReader('Excel2007');
//  Tell the reader to include charts when it loads a file
$objReader->setIncludeCharts(TRUE);
//  Load the file
$objPHPExcel = $objReader->load("rcca.xlsx");

这样写

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->setIncludeCharts(TRUE);
$objWriter->save('rcca.xlsx');

我错过了什么?

请参阅前后图表样式的屏幕截图:

Please see the screenshot of the chart style before and after:

推荐答案

似乎图表样式需要在此时进行硬编码。

It seems that chart styling need to be hard-coded at this time.

在这个其他线程,有人解释如何添加一些样式 PHPExcel图表设计(边框,图表颜色,图表内部位置)

On this other thread someone explain how to add some styling PHPExcel graph design (border, graph color, graph inner position)

这篇关于PHPExcel在加载模板时删除图表样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆