how to read or write Excel 2003 file?

Topics: Developer Forum
Mar 11, 2011 at 9:56 AM
Edited Mar 11, 2011 at 10:01 AM

using phpexcel :  how to  write Excel 2003 file?

Why    phpExcel_IOFactory::createWrite($objPHPExcel, 'Excel5')   

but not like this:   phpExcel_IOFactory::createWrite($objPHPExecl, 'Excel2003'

Mar 11, 2011 at 12:17 PM
On 11/03/2011 09:56, tyds wrote:
using phpexcel   how to  read or write Execl 2003 file?Why    phpExcel_IOFactory::createWrite($objPHPExecl,'Excel5')    not   phpExcel_IOFactory::createWrite($objPHPExec,'Excel2003')  

Because MS Excel2003 uses the same BIFF format as previous versions of MS Excel.
The Excel5 Reader can read files created using:
MS Excel 95
MS Excel 97 (Office 8.0)
MS Excel 2000 (Office 9.0)
MS Excel XP (Office 10.0 or Office 2000)
MS Excel 2003 (Office 11.0)
The Excel5 Writer can write files readable by:
MS Excel 97 (Office 8.0)
MS Excel 2000 (Office 9.0)
MS Excel XP (Office 10.0 or Office 2000)
MS Excel 2003 (Office 11.0)
and (by changing the $_BIFF_version property)
MS Excel 95.

Likewise, the Excel2007 Reader/Writer can read/write files for
MS Excel 2007 (Office 12.0)
MS Excel 2010 (Office 14.0).
because these also use the same format.

... and that's just the releases of MS Excel on Windows: there's different versions of MS Excel on Apple Mac (e.g. Excel 8.0 to Excel 14.0); but they still use the same two basic file formats: BIFF and Office Open XML.

MS Excel 2003 also introduced a new file format: XML Spreadsheet (aka XMLSS) which we can read using the Excel2003XML Reader, but we haven't yet written a writer for this format. However, this is not the default format for MS Excel 2003, it still uses BIFF version 8 as its default format, so we use the Excel5 Reader/Writer.

If we were to provide separate writers for every single version of MS Excel, we'd have a lot of duplicate code that we'd need to maintain and keep synchronised, with no real benefit.

The reasons why we call the readers/writers Excel5 and Excel2007 is historic. Excel5 refers to version 5 of the BIFF format used for xls files (version 5 was introduced in MS Excel 95), while Excel2007 refers to the version of MS Excel when Microsoft introduced the new Office Open XML file format that is used for xlsx files. Changing those to something more meaningful (such as ExcelXLS and ExcelXLSX) would break backward compatibility.

Mark Baker
Mar 12, 2011 at 1:35 AM

thank you for reply.

Sep 16, 2013 at 9:24 PM

does not work... can you explain me what to do?
Sep 16, 2013 at 9:32 PM
Please Explain what "does not work" means.... does it give you an error message or an exception? does it load incorrect values?

If you were a developer, and a user came to you and simply said.... "it doesn't work", would you accept that as a valid comment without asking for further clarification of what doesn't work?