Excel 2010

Topics: Project Management Forum
Feb 29, 2012 at 8:48 PM
Edited Mar 1, 2012 at 12:11 PM

Problem with PHPExcel and Excel 2010.

Coordinator
Feb 29, 2012 at 9:59 PM
Edited Feb 29, 2012 at 10:00 PM

It already does, and has since before 2010: Excel 2007 and Excel 2010 use the same file format, so you can use the Excel2007 Reader and Writer for Excel 2010 files.

Mar 1, 2012 at 7:42 AM
Edited Mar 1, 2012 at 12:11 PM

No, I don't agree

My example :

 

require_once ('PHPExcel\Writer\Excel2007.php');
require_once ('PHPExcel\IOFactory.php');

$objet = PHPExcel_IOFactory::createReader('Excel2007');

$excel = $objet->load('File_Before.xlsx');

$sheet = $excel->getSheet(0);

$sheet->setCellValue('A1', 'Essai');

$writer = PHPExcel_IOFactory::createWriter($excel, 'Excel2007');
$writer->save('File_After.xlsx');

 

 

Message :

_raiseFormulaError message is Formula Error: An unexpected error occured<br />

... (a lot of errors)

_raiseFormulaError message is Formula Error: An unexpected error occured<br />_raiseFormulaError message is Formula Error: An unexpected error occured<br />

Coordinator
Mar 1, 2012 at 10:13 AM
Edited Mar 1, 2012 at 10:13 AM

That doesn't mean PHPExcel doesn't support MS Excel 2010.... it does! What this means that there is something specific (that can't be identified simply here based just on the error message) in one of the formulas in that spreadsheet document that PHPExcel can't handle. This could be any number of things - for example the calculation parser doesn't handle 3D-ranges in formulae - but without seeing the spreadsheet it's difficult to identify what the formula problem is.

 

As a temporary solution, disable calculation in the writer:

$writer->setPreCalculateFormulas(FALSE);

immediately before the save,

Mar 1, 2012 at 11:54 AM
Edited Mar 1, 2012 at 12:09 PM

 

Thanks ! Its work.

But I've lost a lot of Cell's format :

 for example Backgroundcolor :  RGB 83,141,213 -> 0,0,0 from Sheet "MODELE" Range B3:C10

 

My 2 files :

http://ascaphandball.free.fr/temporaire/File_Before.xlsx

http://ascaphandball.free.fr/temporaire/File_After.xlsx

Thx for your help.

Mar 1, 2012 at 12:25 PM

Everything works fine now ....

I was using PHPExcel 1.7.1 ....

I try the last version ....

 

Thx a lot