Home > Article > Backend Development > 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);?
?