Excel 2003 files unreadable with Office 2003

Topics: User Forum
Jun 2, 2010 at 10:25 AM

Hello,

I would like to use PHPExcel in order to build Excel 2003 files (because our clients don't have office 2007 and have not the posssibility ton install the compatobility pack)

But my Excel 2003 files ar not unreadable with Office 2003 !

I tried this :

 
$sheet = $workbook->getActiveSheet();
$sheet->setCellValue('A1','MaitrePylos');
$writer = new PHPExcel_Writer_Excel2007($workbook);
$writer->setOffice2003Compatibility(true);			
$records = '/tmp/'.time().'.xls';			
$writer->save($records);
 

and this :

$sheet = $workbook->getActiveSheet();
$sheet->setCellValue('A1','MaitrePylos');
$writer = new PHPExcel_Writer_Excel5($workbook);
$records = '/tmp/'.time().'.xls';			
$writer->save($records);
 

But no one works.

Hove you got an idea ?
Thanks in advance.
Eric

 

Jun 2, 2010 at 1:03 PM

Hello,

Ok i think the origin of the probleme is mbstring!

Ou php.ini configuration is :

 

mbstring.language=UTF-8
mbstring.encoding_translation = On
mbstring.internal_encoding = UTF-8
mbstring.http_input=UTF-8
mbstring.http_output=UTF-8
mbstring.func_overload = 7

 

 

How can i generate Excel 2003 file whith PHP Excel with mbstring activate ?

Thanks.
Eric.

 

Jun 2, 2010 at 1:40 PM

Ok.

It works if i put :

ini_set('mbstring.internal_encoding', 'ISO-8859-1');

 

before

 

$sheet = $workbook->getActiveSheet();
$sheet->setCellValue('A1','MaitrePylos');
$writer = new PHPExcel_Writer_Excel5($workbook);
$records = '/tmp/'.time().'.xls';			
$writer->save($records);