首页 > 代码库 > PHPExcel SUM 返回0

PHPExcel SUM 返回0

使用PHPExcel 导出Excel最后的代码是:

$objWriter = PHPExcel_IOFactory::createWriter($this->excel, Excel2007);//force user to download the Excel file without writing it to server‘s HD$objWriter->save(php://output);

 导出的Excel的"=SUM(A1:A10)"的和还是0,解决方法是在"$objWriter->save(‘php://output‘);"之前添加"$objWriter->setPreCalculateFormulas(true);"

 

参考: PhpExcel SUM() returning 0

PHPExcel SUM 返回0