我是
PHPExcel的新手,我需要你的帮助 –
计算总和时,我在PHPExcel中的setCellValue有问题.它给我总是0.
计算总和时,我在PHPExcel中的setCellValue有问题.它给我总是0.
这是我的代码:
$objPHPExcel = PHPExcel_IOFactory::load("test.xls"); $row = 5; $S = $objPHPExcel->getActiveSheet(); while($row_data = MysqL_fetch_array($result)){ $S->setCellValueExplicit('B'.$row,$row_data['cn']); $S->setCellValueExplicit('C'.$row,$row_data['ld']); $S->setCellValueExplicit('D'.$row,$row_data['cust_notify']); $S->setCellValueExplicit('E'.$row,$row_data['code']); $S->setCellValueExplicit('F'.$row,$row_data['company_name']); $S->setCellValueExplicit('G'.$row,$row_data['rs']); $S->setCellValueExplicit('H'.$row,$row_data['status']); $S->setCellValueExplicit('I'.$row,$row_data['sueend']); $S->setCellValueExplicit('J'.$row,$row_data['vclaimed']); $S->setCellValueExplicit('K'.$row,$row_data['ref']); $S->setCellValueExplicit('M'.$row,$row_data['out']); $row++; $S->setCellValue("I$row","Total"); $S->setCellValue("J$row","=SUM(J5:J".($row-1).")"); }
我得到的结果总是“0”.打印屏幕
如果有人可以帮我解决这个问题,我真的很感激.
提前致谢
试试这个
原文链接:https://www.f2er.com/php/134836.html$writer = PHPExcel_IOFactory::createWriter($excel,'Excel2007'); $writer->setPreCalculateFormulas(true);