Problem with "0" inside cells

Topics: User Forum
Feb 20, 2009 at 11:27 AM
Hello

When i write a numeric string with zeros on the left, excel replace it when i open de XLSX.
Here is how i write the string:

$objPHPExcel->getActiveSheet()->SetCellValue('C'.$inicio,$data['cliente']);

Example:

http://i39.tinypic.com/b4gwlw.jpg


Sry for my bad english and thank you
Developer
Feb 20, 2009 at 11:39 AM
Method:

$objWorksheet->getCell('A1')->setValue(1584505);
$objWorksheet->getStyle('A1')->getNumberFormat()->setFormatCode('00000000');

Gives you: 01584505

Screen shot:
http://img207.imageshack.us/img207/2392/leadingzeroxlsxui0.png

Feb 20, 2009 at 1:38 PM
Fatal error: Call to undefined method PHPExcel::getStyle() in /homepages/35/d223808724/htdocs/Plesk/modulos/excel/generar-excel.php on line 56
Coordinator
Feb 20, 2009 at 2:37 PM
$objPHPExcel->getActiveSheet()->getCell('A1')->setValue(1584505);
$objPHPExcel->getActiveSheet()->getStyle('A1')->getNumberFormat()->setFormatCode('00000000');