Hello.
I would like to know how autodetect file format works in fpspreadsheet. For now it seems it just analyse file extension like xls - Excel 8, xlsx - Office XML and so on. But I have a problem when our partners send us xls files,which are actually xlsx files with manually changed extension. The same problem is with Excel 5 files when fpspreadsheet see them as normal Excel 8 files.
Is there a way to detect the format regardless of extension?
First of all: Tell your customers never to do this. Even Excel cannot read an xls file renamed to xlsx! (LibreOffice Calc on the other hand can...)
Yes, fpspreadsheet relies on the extension to distinguish between the main file formats. Only in case of xls (which may contain either BIFF2, BIFF5 or BIFF8 binary formats) it reads the header and makes a decision based on characteristic differences. But since it is easy to check the signature of zipped files ('PK' in the first two bytes) I also added xlsx and ods to this test now. However, to distinguish between these two fpspreadsheet must try to read the files and catch the exception of the reader (while your program is running in the debugger, the IDE will generate an exception which will not occur when the program is run outside the IDE. But you can avoid this by adding the exception type EFPSpreadsheetReader to the "Language Exceptions" under "Tools" > "Options" > "Debugger").
So, update your fpspreadsheet to the current svn version and fpspreadsheet will accept xls files "disguised" as ".xlsx" or ".ods", or ".abc" or whatever.