简体   繁体   中英

Invalid file format when attempting to read Excel 2007 files in PHP

I am trying to read data from Excel 2003 but I want the system also to load Excel 2007 files. However Excel 2007 file is triggering the file format exception. The code that checks the format is here

if ($this->header ['ident'] != "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1")
        throw new compoundDocumentException ('Invalid file format');

In this line I would like to add the header indent for Excel 2007 which I didn't find wherever I tried.

How do I achieve this please?

Excel 2007 files ( .XLSX files) use a completely different XML-based format from previous versions of Excel. Simply checking for a new header will not help you at all here -- you will need an entirely different file reader for these newer files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM