Ask to avoid the problem that the xls file phone number exported by phpexcel and the ID card are displayed in scientific notation! Phpexcel is used for export in recent projects, which is relatively good, but there are several headaches, that is, when exporting data columns, data of the type 013434342333, 053482371284, and 42221312312312312312213 is automatically displayed in scientific notation. for details, see how to display the complete numerical records. the version I used is 1.7.6. thank you, please let me know!
Reply to discussion (solution)
$objStyleA5 ->getNumberFormat() ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER);
As you said on the first floor, Are You Normal ??
I am using 1.7.6 ..
But there is a small trick to solve it.
When you do not need to be the value of the... character in the column of a number
$ ObjPHPExcel-> getActiveSheet ()-> setCellValueByColumnAndRow (0, $ I, ''. $ rs ['cardn']);
Note: add a space here. excel is processed as a string by default ..
PHP code
$ ObjStyleA5
-> GetNumberFormat ()
-> SetFormatCode (PHPExcel_Style_NumberFormat: FORMAT_NUMBER); I also solve the problem by adding spaces, but it is always uncomfortable to carry spaces. do you have any good methods on the second floor ?!
Some articles on the Internet say that some of the source code can be implemented, but the version I use is too high and I cannot find the location where the source code is. if you find a better solution, please kindly advise. thank you !!!
$ ObjPHPExcel-> getActiveSheet ()-> setCellValueByColumnAndRow (0, $ I, $ rs ['cardn'], PHPExcel_Cell_DataType: TYPE_STRING );
Specify the cell type as text. how can this problem be solved?
The previous version seems to have been specified and displayed in scientific notation, so you need to modify the code. The new version should have a specified type.
#include
void main{printf('%d'&b);}
Method 1: add spaces to the front;
Method 2: $ objActSheet-> setCellValueExplicit ('A1', '000000', PHPExcel_Cell_DataType: TYPE_STRING );
Method 3:
$ ObjActSheet-> setCellValue ('A1', '123 ');
$ ObjActSheet-> getStyle ('A1')-> getNumberFormat ()-> setFormatCode (PHPExcel_Style_NumberFormat: FORMAT_NUMBER );
In my practice, it is best to use method 2.