Home > Article > Backend Development > Long numbers exported by PHPExcel are solved by scientific notation conversion and missing data
The F column of the EXCEL table is a long number, such as 2015072708542427700014133717. After exporting, it will become 201507270854242770001410000. Search the Internet for solutions. The first solution is to set the F column in string form, as follows
$objPHPExcel = new PHPExcel() ;
//Set column F (order number) to text format}The result failed, maybe setting the format something went wrong.
Then continue searching and find the second way
// operate the first worksheet
$objPHPExcel->setActiveSheetIndex(0);
$i=1;
foreach($ info as $row){
$asc2 = 65;
foreach($row as $field){
$objPHPExcel->getActiveSheet()->setCellValueExplicit(chr($asc2++).$ i, $field, PHPExcel_Cell_DataType::TYPE_STRING);
}
$i++;
}Specify the type of this data when setting the cell, and it will be successful.
The above introduces the solution to the problem of missing data when long numbers exported by PHPExcel are converted into scientific notation, including aspects of the problem. I hope it will be helpful to friends who are interested in PHP tutorials.