简体   繁体   中英

Reading MS Excel 2007 file using PHP

I am trying to read excel 2007 file through php. I found one such example on PHP COM manual but it only works on windows system since COM objects require MS Excel to be installed. Since I have Linux machine that code doesn't work for me.

Does anybody know the workaround for this?

Due to some restrictions, I don't want to use any outside libraries (PHP-ExcelReader, PHPExcel, etc.) to do the same.

Thanks,

I don't know why you're so unwilling to use libraries that have been specially written to do exactly what you're requesting, but there are still a couple of options open to you.

Excel2007 files are simply a zipped series of XML files, so it is perfectly possible to parse them with SimpleXML or XMLReader, and the format is fully documented on the MS website (don't have the link to hand at the moment, unfortunately), so you can always "roll your own". It's likely to take a while (I've been working on PHPExcel now for over 3 years and it still doesn't support all features of the Excel 2007 format), but look at the PHPExcel Excel2007 Reader for some idea on how to do so, even if you're unwilling to use the library.

Alternatively, Open Office Calc supports COM and COM can be mimicked on other OS's (XPCOM, CORBA); or you could probably fake it using WINE.

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