Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-11

[ANN] FPSpreadsheet date support - success story

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Reinier Olislagers

Hi all,

I've looked into adding date/time support for BIFF8/XLS and seem to have it working.
As long as I'm busy with fpspreadsheet, I'm incorporating some other fixes I had going and added an FPCUnit test suite to check against regressions.

When I've got the tests extended some more and have gone through all the changes again, I'll upload it to mantis for the fpspreadsheet devs to have a look and hopefully include it.

Meanwhile, you can try it out for yourself:
https://bitbucket.org/reiniero/smalltools/downloads/fpspreadsheet_27November.zip

As usual, comments and code suggestions welcome.

Thanks,
Reinier

My work-in-progress notes:
- Added FPCUnit test suite to test reading and reading writing files. For now uses BIFF8 xls; contributions for other formats and more tests welcome. See the tests subdirectory.
- XLS BIFF8: added DATE and TIME worksheet functions to RPN formula
- Allow writing formula,*<check others, cardinal changes> fields for formats that support it.
Note: changes public signature from word to cardinal=> check: this shouldn't impact existing code, should it? Anyway, the same change was done for the label/text cell support earlier
- Add date/time/datetime read/write support for BIFF8 xls format. No plans for earlier formats though the code could be adapted
- Add checks for text cell size limits when writing xls, xml. If exceeded, cell text will be truncated and an exception will be raised you can use try..except to discard this exception in your application if wanted
- Formats that use zip have extra checks to prevent crashes for invalid zip dates
- Use FPC built-in zip format when using FPC 2.7.1+ as it has fixes/improvements (e.g. zip64 support)

Reinier Olislagers
to Reinier Olislagers
Reinier Olislagers wrote 6 lines
I've looked into adding date/time support for BIFF8/XLS and seem to have it working. As long as I'm busy with fpspreadsheet, I'm incorporating some other fixes I had going and added an FPCUnit test suite to check against regressions.

Uploaded patch+new files to
http://bugs.freepascal.org/view.php?id=25388

Changes with previous version
- updated/added tests, added command-line test
- don't raise an exception with overlong strings as it messes with writing xls. Instead truncate to a safe value. Still better than silently corrupting the file.

silvioprog
to Reinier Olislagers

2013/11/30 Reinier Olislagers

Show quoted text 17 lines
On 27/11/2013 09:43, Reinier Olislagers wrote: > I've looked into adding date/time support for BIFF8/XLS and seem to have > it working. > As long as I'm busy with fpspreadsheet, I'm incorporating some other > fixes I had going and added an FPCUnit test suite to check against > regressions. > Uploaded patch+new files to http://bugs.freepascal.org/view.php?id=25388 Changes with previous version - updated/added tests, added command-line test - don't raise an exception with overlong strings as it messes with writing xls. Instead truncate to a safe value. Still better than silently corrupting the file.

Very nice buddy! :)

Silvio Cl?cio My public projects - github.com/silvioprog -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131130/5ee35393/attachment.html>