嗨,我想添加图表,我在尝试
时错过了这个错误键入:PHPExcel_Calculation_Exception 消息:内部错误 文件:C:\ xampp \ htdocs \ php-excel-inf-graf \ vendor \ phpoffice \ phpexcel \ Classes \ PHPExcel \ Calculation.php 行:3734
我的代码摘要:
ids = if params[:ids].is_a? Array
params[:ids]
elsif params[:ids]
params[:ids].split(",")
end
然后我做 public function addChart1($objPHPExcel)
{
$objWorksheet = $objPHPExcel->setActiveSheetIndexByName('Graficos');
$dataseriesLabels1 = [
new PHPExcel_Chart_DataSeriesValues('String','SMS Certificado Totales!$F$6',NULL, 1),
];
$xAxisTickValues = [
new PHPExcel_Chart_DataSeriesValues('String','SMS Certificado Totales!$B$6:$B$11',NULL, 6),
];
$dataSeriesValues1 = [
new PHPExcel_Chart_DataSeriesValues('Number', 'SMS Certificado Totales!$F$8:$F$11', NULL, 4),
];
$series1 = new PHPExcel_Chart_Dataseries(
PHPExcel_Chart_DataSeries::TYPE_LINECHART,
PHPExcel_Chart_DataSeries::GROUPING_STANDARD,
range(0,count($dataSeriesValues1)-1),
$dataseriesLabels1,
$xAxisTickValues,
$dataSeriesValues1
);
$series1->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_COL);
$plotarea = new PHPExcel_Chart_PlotArea(NULL, array($series1));
$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_RIGHT, NULL, false);
$title = new PHPExcel_Chart_Title('Mi primer Chart');
$chart = new PHPExcel_Chart(
'chart1', // name
$title, // title
$legend, // legend
$plotarea, // plotArea
true, // plotVisibleOnly
0, // displayBlanksAs
NULL, // xAxisLabel
NULL // yAxisLabel
);
$chart->setTopLeftPosition('A7');
$chart->setBottomRightPosition('H20');
$objWorksheet->addChart($chart);
}
;在另一个文件
此致
编辑:第3734行的代码:
$objWriter-> setIncludeCharts (TRUE)