fpspreadsheet: Improved auto-format detection (check extension first, check file header when extension test fails). Fix ods reader crashing when extension has been renamed.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6760 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-12-18 00:07:16 +00:00
parent ca80c68d6b
commit 02281cd15f
3 changed files with 108 additions and 76 deletions

View File

@@ -1370,7 +1370,7 @@ var
fileformats: TsSpreadFormatIDArray;
begin
fileFormats := GetSpreadFormatsFromFileName(faRead, AFileName, ord(sfExcel8));
Result := (Length(fileFormats) > 0) and (fileFormats[0] <= sfidUnknown);
Result := (Length(fileFormats) > 0); // and (fileFormats[0] <= sfidUnknown); // wp - removed for new format detection
if Result then AFormatID := fileFormats[0];
end;