When exporting data to excel in php, the numeric format becomes scientific count. when exporting data to excel, the numeric format is incorrect. Generally, the following two cases are involved: 1. the length of the excel cell is not enough. The solution is as follows: // in excel. in the php file, $ objActSheet = $ objPHPExcel-& gt; ge converts the number to scientific count when it is exported to excel in php.
When exporting data to excel, the numeric format is incorrect. the following two situations are generally used:
1. the length of an excel cell is not enough. The solution is as follows:
// In excel. $ objActSheet = $ objPHPExcel-> getActiveSheet (); // set the topic name $ objActSheet-> setCellValue ("b1", "Card number "); // Set the column width $ objActSheet-> getColumnDimension ('B')-> setWidth (20); // change the length value set here
2. when the character is understood as a number in excel, it is generally set to text or try to add spaces. my solution is as follows:
// Add data, mainly to process the data to be displayed using the chunk_split () function. for specific usage of this function, you can view $ objActSheet-> setCellValue ("B $ I ", chunk_split ("123456789", 4, ""); // of course, if you do not want to see spaces between numbers, set the value of the field to be split to a greater value, for example, set 4 to a value greater than or equal to 9.