php导出excel时,如何实现科学计数法,代码如下:
<?php //excel科学计数法 $activeSheet->getStyle($this->numToEn($col).($row+2))->getNumberFormat()->setFormatCode(phpexcel_Style_NumberFormat::FORMAT_TEXT); $activeSheet->setCellValue($this->numToEn($col).($row+2)," ".$elements[$row][$col]); //写入Excels单元格的内容之前加一个空格,防止长数字被转化成科学计数法 $activeSheet->getStyle($this->numToEn($col).($row+2))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); ?>