开发者

phpExcel write long number in cell

开发者 https://www.devze.com 2023-02-11 18:53 出处:网络
While writing the excel file is fine I see that really long numbers are formulas i开发者_运维问答n excel

While writing the excel file is fine I see that really long numbers are formulas i开发者_运维问答n excel

Example: 8.71129E+12

instead of: 1234567890

How can I change the format during the PHP Excel Creation?

I'm following the simple example here


$objPHPExcel->getActiveSheet()->setCellValueExplicit('A1', '1234567890', PHPExcel_Cell_DataType::TYPE_STRING);


Either set the value explicitly as a string, or set a number format mask for the cell that forces display of all digits (e.g. '#,##0' 0r '0') rather than default format.


Try this code it's works for me :

$objPHPExcel
   ->getActiveSheet()
   ->getCellByColumnAndRow($col, $row)
   ->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING);

And Good luck !

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号