PHPExcel和Office 2016

我目前正在使用PHPExcel(v1.8.0)生成带有数据和graphics的xlxs文件。 但是,当我在办公室打开我生成的文件,我得到一个错误。 我试图用“setPlotDirection”方法精确定位,并删除y轴标签。

这是代码:

$categories = array( new \PHPExcel_Chart_DataSeriesValues('String', "'".$this->oSheet->getTitle()."'!\$A$5:\$A$31", null, 1) ); $values = array( new \PHPExcel_Chart_DataSeriesValues('Number', "'".$this->oSheet->getTitle()."'!\$BA$5:\$BA$31", null, 1), ); $this->createChart($categories, $values, 'Title', 'Xlegend', 'YLegend', 'A34', 'K50'); function createChart($categories, $values, $title, $xLegnd, $yLegend, $topLeft, $bottomRight) { $series = new \PHPExcel_Chart_DataSeries( \PHPExcel_Chart_DataSeries::TYPE_BARCHART, \PHPExcel_Chart_DataSeries::GROUPING_STANDARD, range(0, count($values) - 1), null, $categories, $values ); $series->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_VERTICAL); $layout = new PHPExcel_Chart_Layout(); $layout->setShowVal(true); $plotArea = new \PHPExcel_Chart_PlotArea(null, array($series)); $title = new \PHPExcel_Chart_Title($title); $yAxisLabel = new \PHPExcel_Chart_Title($yLegend); $xAxisLabel = new \PHPExcel_Chart_Title($xLegnd); $chart = new \PHPExcel_Chart( $title, $title, null, $plotArea, true, 0, null, $yAxisLabel ); $chart->setTopLeftPosition($topLeft); $chart->setBottomRightPosition($bottomRight); $this->oSheet->addChart($chart); } 

所有Excel 2010/2011和Libre Office都可以正常工作。 但是,我得到这个Excel 2016的错误:

 <recoveryLog> <logFileName>error066200_01.xml</logFileName> <summary>Des erreurs ont été détectées dans le fichier xxx</summary> <removedParts> <removedPart>Partie supprimée: /xl/drawings/drawing3.xml partie. (Forme de dessin)</removedPart> </removedParts> </recoveryLog> 

任何想法 ? 谢谢