Sign in Join

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

Mailing lists / fpc-pascal / 2009-01

Suggestions for fpspreadsheet

14 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

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

Felipe Monteiro de Carvalho

Hello,

I got some time and I decided to improve fpspreadsheet: http://wiki.lazarus.freepascal.org/FPSpreadsheet

I wrote a OLE document generator, so now it is possible to generate Excel 5 spreasheets in any platforms (actually some lines of code are missing for big endian systems). And it supports numbers, text and formulas, as well as multiple worksheets in the same file. Excel 2 support is also complete.

I have some more time, but I am not entirely sure what would really add value to the library, so I thougth I would ask possible users what they really need (I already have all the functionality I need). Some ideas I had are:

* Add support to also read Excel 5 files
* Add write support to other formats
* More advanced formulas
* Make charts (maybe too hard?)

I went for Excel 5 because it's supported by nearly all spreadsheet software out there and has lot's of features.

I am not saying I will implement any of this in a short time, just asking for suggestions =)

thanks,

Felipe Monteiro de Carvalho
Boris Samorodov
to Felipe Monteiro de Carvalho

Hello List,

Show quoted text 8 lines
I got some time and I decided to improve fpspreadsheet: http://wiki.lazarus.freepascal.org/FPSpreadsheet I wrote a OLE document generator, so now it is possible to generate Excel 5 spreasheets in any platforms (actually some lines of code are missing for big endian systems). And it supports numbers, text and formulas, as well as multiple worksheets in the same file. Excel 2 support is also complete.

Very interesting. Thanks for your work!

Show quoted text 6 lines
I have some more time, but I am not entirely sure what would really add value to the library, so I thougth I would ask possible users what they really need (I already have all the functionality I need). Some ideas I had are: * Add support to also read Excel 5 files

I'd vote for this one twice if possible. ;-)
As for the others they are interesting but not very important for me.

Show quoted text 9 lines
* Add write support to other formats * More advanced formulas * Make charts (maybe too hard?) I went for Excel 5 because it's supported by nearly all spreadsheet software out there and has lot's of features. I am not saying I will implement any of this in a short time, just asking for suggestions =)

WBR

bsam
Graeme Geldenhuys
to Felipe Monteiro de Carvalho: I got some time and I decided to improve fpspreadsheet:…
Felipe Monteiro de Carvalho wrote
I am not saying I will implement any of this in a short time, just asking for suggestions =)

OpenDocument read/write support -- seeing that that is the preferred format these days and adheres to open standards.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Felipe Monteiro de Carvalho
to Boris Samorodov: Very interesting. Thanks for your work! I'd vote for this one twice if possible. ;-) As…
Boris Samorodov wrote
> * Add support to also read Excel 5 files I'd vote for this one twice if possible. ;-) As for the others they are interesting but not very important for me.

I went for this one. Excel 2.1 reading works nicely.

It also reads Excel 5 files generated by fpspreadsheet, but I didn't test with files coming from Excel and Open Office.

Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho
to Felipe Monteiro de Carvalho

I also added initial OpenDocument support. Initially I wanted to do OOXML, but OpenOffice can only read OOXML, not write it, and I don't have Word, so I found myself unable to generate example documents and went for OpenDocument.

A doubt I am facing now is if rows and column numbers should start at 1 like what is seen in most spreadsheet user interfaces or in zero ..... It was zero before, but now I am changing it to 1, althougth I am still not sure of the best option ... ideas?

thanks,

Felipe Monteiro de Carvalho
Michael Van Canneyt
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 9 lines
I also added initial OpenDocument support. Initially I wanted to do OOXML, but OpenOffice can only read OOXML, not write it, and I don't have Word, so I found myself unable to generate example documents and went for OpenDocument. A doubt I am facing now is if rows and column numbers should start at 1 like what is seen in most spreadsheet user interfaces or in zero ..... It was zero before, but now I am changing it to 1, althougth I am still not sure of the best option ... ideas?

I think they should start at 0; This is customary in most code.

Michael.

Graeme Geldenhuys
to Felipe Monteiro de Carvalho: I also added initial OpenDocument support. Initially I wanted to do OOXML, but OpenOffice…

On Thu, Jan 29, 2009 at 2:25 PM, Felipe Monteiro de Carvalho

Show quoted text 5 lines
A doubt I am facing now is if rows and column numbers should start at 1 like what is seen in most spreadsheet user interfaces or in zero ..... It was zero before, but now I am changing it to 1, althougth I am still not sure of the best option ... ideas?

hehehe... I went through that same process in fpGUI's grid components (and other list components like listbox etc.). I made all components 1-based as that seemed logical to me. You start counting from 1, the 1st item has the number 1 etc... After a few months and confusing the sh*t out of many developers, I switched back to 0-based counting.

Part of the confusion was what developers were used to in Delphi. Plus many (all) container classes in the RTL use 0-based counting. It becomes quite a chore to keep track of 1-based counting in the grid and when that data is stored internally in some RTL container class, to switch to 0-based counting.

So purely for the sake of simplicity (and saving yourself a lot of grey hair), I would recommend you follow the crowd and go with 0-based counting.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Travis Siegel
to Michael Van Canneyt: I think they should start at 0; This is customary in most code. Michael.
Michael Van Canneyt wrote 10 lines
On Thu, 29 Jan 2009, Felipe Monteiro de Carvalho wrote: > > A doubt I am facing now is if rows and column numbers should start at > 1 like what is seen in most spreadsheet user interfaces or in zero > ..... It was zero before, but now I am changing it to 1, althougth I > am still not sure of the best option ... ideas? I think they should start at 0; This is customary in most code.

And here is the difference between programmers and users. Yes, most programmer interfaces start at 0, but when a user opens your sreadsheet, they expect to see their first cell number as a1, not a0. I personally always make my code 1-based, because I am not a computer, and nobody I know starts counting at 0, and their program interfaces should reflect that.
Besides, starting at 0 throws off human-made calculations. When someone says how many rows aare in my spreadsheet, they'll drop to the bottom of the sheet, and see that it goes to h84 or c62, and just assume oh, that's how many rows there are. Not so if you 't confuse the poor users, start at 1.

Graeme Geldenhuys
to Travis Siegel: And here is the difference between programmers and users. Yes, most programmer interfaces…
Travis Siegel wrote 6 lines
And here is the difference between programmers and users. Yes, most programmer interfaces start at 0, but when a user opens your sreadsheet, they expect to see their first cell number as a1, not a0. I personally always make my code 1-based, because I am not a computer, and nobody I know starts counting at 0, and their program interfaces should reflect that.

I fully agree. So to add to my previous reply. Internally (for the developers), use 0-based counting. But when things are displayed visually to the _user_ i would definitely display the first row as 1.

That means all internal RTL container classes including your component uses 0-based counting. Only the painting gets done as 1-based counting.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Felipe Monteiro de Carvalho
to Graeme Geldenhuys: On Thu, Jan 29, 2009 at 2:25 PM, Felipe Monteiro de Carvalho hehehe... I went through…
Graeme Geldenhuys wrote 5 lines
Part of the confusion was what developers were used to in Delphi. Plus many (all) container classes in the RTL use 0-based counting. It becomes quite a chore to keep track of 1-based counting in the grid and when that data is stored internally in some RTL container class, to switch to 0-based counting.

Yes, you convinced me. Moving back to 0-based =)

And in the process I noticed that even in my own code to support OpenDocument I needed to add some + 1 and - 1 here and there because arrays are zero-based ...

It's interresting that OpenDocument is 1-based ... maybe because it's user readable. Excel binary files were all zero-based (good for programmers, and the format isn't user readable) ... don't know about OOXML.

Felipe Monteiro de Carvalho
Michael Van Canneyt
to Graeme Geldenhuys: I fully agree. So to add to my previous reply. Internally (for the developers), use…
Graeme Geldenhuys wrote 15 lines
On Thu, Jan 29, 2009 at 3:09 PM, Travis Siegel wrote: > And here is the difference between programmers and users. > Yes, most programmer interfaces start at 0, but when a user opens your > sreadsheet, they expect to see their first cell number as a1, not a0. > I personally always make my code 1-based, because I am not a computer, and > nobody I know starts counting at 0, and their program interfaces should > reflect that. I fully agree. So to add to my previous reply. Internally (for the developers), use 0-based counting. But when things are displayed visually to the _user_ i would definitely display the first row as 1. That means all internal RTL container classes including your component uses 0-based counting. Only the painting gets done as 1-based counting.

For me this is so self-evident, that I didn't even bother to write it :(

I was only making a statement as to how it is coded.

Display to the user must obviously be 1 and A based.

Michael.

Marco van de Voort
to Michael Van Canneyt

In our previous episode, Michael Van Canneyt said:

> uses 0-based counting. Only the painting gets done as 1-based > counting.

Can't we simply compromise and make it 0.5 everywhere ? :-)