I am exporting some data to Excel using PHPExcel. Everything is working fine except some strange behavior that the export replaces the last three digits of a number by zeros.
For example I have this number: 876685900060999549
But when exporting is it like : 876685900060999000
As you can see only the last three digits are replaced by zeros. I have already tried to use setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_NUMBER )
but unfortunately this didn't work.
Does someone know why only the last three digits are replaced by zeros and how this can be prevented?
Those numbers are too large to be represented as a 32-bit integer in PHP (or in MS Excel) so they are being converted to float with a corresponding loss of precision.
To get round this, you'll need to force them to be treated as string values: you don't show your code, but try using setCellValueExplicit()
to force the datatype to string
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments