Error with Reader 2007

Topics: Developer Forum
Feb 20, 2008 at 5:24 AM
I'm trying to use PHPExcel to open an existing .xlsx file w/ formatting and formulas, then update some cells, then save a copy of the .xlsx file with the formatting and new values.

When I run my script I get the following error 3 times in a row :

Warning: Invalid argument supplied for foreach() in C:\WebDev\DDH\www-new\test\PHPExcel\Reader\Excel2007.php on line 597

My script does finish and creates my final .xlsx file, but some of the background colors end up in a black color which makes the black text unreadable.

I'm using WinXP/Apache (xamp)/PHP 5.something and have gone through to ensure I have all the requirements listed.

I tried testing my script by not reading the .xlsx file first and everything works fine, no errors. But I do not end up with my formatted spreadsheet, just the values I inserted into the new one.

Any help would be greatly appreciated.
Feb 22, 2008 at 1:54 PM
Are you using the latest (1.6.0) version of PHPExcel?
The line in the error refers to this piece of code:
foreach ($xmlWorkbook->definedNames->definedName as $definedName) {

Are you using defined names in your worksheet?
Feb 25, 2008 at 10:01 AM
Will be fixed, forgot a is_null check...
Feb 25, 2008 at 10:01 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Feb 29, 2008 at 10:31 AM
Hello Maartenba,

I got the same error as tonynl...

I just check the link you posted but nothing indicate what do to in this case... maybe you can put as attachement in the work item link the new file?
Thanks a lot!

Feb 29, 2008 at 10:44 AM
Try the last "nightly build" on, this solves the problem mentioned.
Feb 29, 2008 at 10:54 AM
Ok, I just tried it is working perfectly!

Thanks a lot, Maartenba!

Have a good day! ;-)