Windows 7: “Excel found unreadable content”

phpexcelwindows 7

I'm using PHPExcel to generate a very simple .xls file (PHPExcel_IOFactory::createWriter($PHPExcel, 'Excel5')). Whenever that file is opened on Windows 7 using Excel 2010 or 2007, I get the following error:

Excel found unreadable content in 'XXXXXXX.xls'. Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes.

When I open the same file in Excel 2010 in Windows XP it works fine. If I open the same file in OpenOffice, it works regardless of the OS.

Windows 7 / Excel 2010: Error

Windows 7 / Excel 2007: Error

Windows XP / Excel 2010: Works

Windows XP / Excel 2007: Works

Any / OpenOffice: Works

When I tell PHPExcel to generate an .xlsx file (PHPExcel_IOFactory::createWriter($PHPExcel, 'Excel2007')), it works fine with all the above combinaisons.

I found countless threads on the MS forums, and it seems to affect only Windows 7 files with Excel files generated by third party libraries (not just PHPExcel). But no one has a solution.

I also found the following MS KB article, but I'm not familiar with the underlying Excel specifications: http://support.microsoft.com/kb/2411912

Has anyone else experienced this?

Best Answer

If it is the problem you've highlighted from the MS Support site, then it's locked somewhere in the innards of PHP_OLE, probably in the PHPExcel_Shared_OLE_PPS_File class. I've raised this as Issue 15508 on the PHPExcel site, and will try to run some debugging over the weekend on a Windows 7 box.

No guarantees of a quick fix: but you've given me a pointer on how to try and recreate the problem, and where to look.

Related Topic