Windows 7: "Excel found unreadable content"

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

Excel found unreadable content in 'XXXXXXX.xls'. Do you want to restore the contents of this book? If you trust the source of this book, 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 say PHPExcel to generate the .xlsx file ( PHPExcel_IOFactory::createWriter($PHPExcel, 'Excel2007') ), it works fine with all of the above combinations.

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

I also found the following MS KB article, but I am not familiar with the basic Excel specs: http://support.microsoft.com/kb/2411912

Has anyone else experienced this?

+7
source share
3 answers

If this is a problem that you highlighted on the MS support site, then it is locked somewhere in the inside of PHP_OLE, possibly in the class PHPExcel_Shared_OLE_PPS_File. I picked it up as Issue 15508 on the PHPExcel website and will try to do some weekend debugging in a Windows 7 window.

There is no guarantee of a quick fix: but you showed me how to try to recreate the problem and where to look.

+2
source

This was fixed for me when I used the correct UTF-8 encoded strings instead of ISO-8859-1. Maybe PHPExcel might hint at the wrong encodings?

+1
source

You need to write UTF-8 fields for title, creator, LastModifiedby, etc ..... This was my solution.

+1
source

All Articles