May 9, 2014 at 7:23 AM
Edited May 9, 2014 at 8:29 PM
Hi. I'm using PHPExcel 1.8.0, 2014-03-02; PHP5.4.6 on LinuxMint14
While creating Excel Sheet and adding text in cells some of them are automatically changed into date.
First I was using such code :
$objPHPExcel = new PHPExcel();
//this value is set harcoded, in actual script this value is from parsed html;
After writing xls to file and opening in LibreOffice the value is altered to date '01.05.2011';
So I've altered my script to:
$objPHPExcel->getActiveSheet()->setCellValueExplicit('A1', 'v11', PHPExcel_Cell_DataType::TYPE_STRING2);
It didn't helped at all.
So I've added such line just before 'setCellValueExplicit();
This helped .. not much. All I got was value : 40664
I've no idea what to do NEXT.
I've foud solution myself.
I was writing excel as 'Excel2007'
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
when I changed this to 'Excel5'
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
everything was OK.