Recent

Author Topic: Can't read LibreOffice files .ods  (Read 829 times)

wp

  • Hero Member
  • *****
  • Posts: 7076
Re: Can't read LibreOffice files .ods
« Reply #15 on: May 23, 2020, 12:58:44 pm »
Thanks for your replies and help.

Since Libre and OpenOffice are able to save and read files under xlsx format, which has apparently no problem with FRSpreadsheet, I think I will consider to use that file format instead of ods (provided there are no problematical format conversion restrictions, which I will have to check).

I don't like too much to ignore an error message which eventually could be raised by other problems than the one we try to solve.
But for the other cases which are not handled by the library you will still see the error message displayed by the application (the one you see is displayed by the debugger). In this (rare) case you still can reactivate the debugger exception to make the program stop when the exception occurs.

I hope it will be a temporary exception.
I don't think so. Raising an exception when a file cannot be read is the ultimate notification of the user, and it will always be there.

But let me say again: You can avoid the exception when you specify the format in the ReadFromFile call. So when you know that your files are .ods, then why don't you specify the format directly instead of (ab)using automatic format detection?

And another solution which has not been mentioned before: You could also switch your fpspreadsheet to the trunk version in which format detection is a bit more sophisticated. Just download the snapshot from https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/fpspreadsheet/.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

straetch

  • Jr. Member
  • **
  • Posts: 63
Re: Can't read LibreOffice files .ods
« Reply #16 on: May 24, 2020, 10:51:56 am »
In my case the automatic format detection is necessary. My program collects spreadsheets from different authors that can provide their data in different formats (xls, xlsx, ods, csv).
I have set "ignore this exception type" at project level.
I don't worry about this because the exception class 'EFpSpreadsheetReader' is defined in the fpspreadsheet package.
Since the author of the package says there is no problem with this, why should I doubt this?
I am happy with the temporary solution.
Many thanks.

 

TinyPortal © 2005-2018