Genii Weblog

In a hypothetical Midas for ODF...

Thu 4 Jan 2007, 11:37 PM



by Ben Langhinrichs
would a chunk defined (in a word processing context) as "Table 1; Row 3-7; Column 4-5" be equivalent (in a spreadsheet context) to "Sheet 1; Cell D3-E7"?  It makes you think.

Copyright © 2007 Genii Software Ltd.

What has been said:


538.1. Alan Bell
(01/05/2007 01:38 AM)

Personally I would say it was cell C2-D6 because I like things to start at zero, opinions vary on this. I think it is a fantastic idea to have Midas for ODF. Midas presents an incredible API for working with content. My session at Lotusphere involves some wrapping of the OpenOffice UNO api with a simplified set of Lotusscript classes which basically wrap a complex API with a simple API. The Midas API is very different to my approach, it is more human readable and closer to a natural language interface than my object oriented system. Midas has 2 unique selling points, firstly it has an implementation that works with Notes CD records, secondly it has a novel and powerful command structure. The API would be just as uniquely powerful in the ODF world even though the implementation target isn't as hellishly difficult to work with as the bowels of Rich Text are.


538.2. Ben Langhinrichs
(01/05/2007 07:20 AM)

While I regularly work with zero based offsets myself in C/C++, they couldn't be used in this case because both OpenOffice.org Calc and the IBM Spreadsheet Editor (and Microsoft Excel and Lotus 1-2-3) use one-based addressing, and there would be no point in doing something different.

I am hoping to catch your presentation at Lotusphere, as I haven't worked much with the UNO API.


538.3. Alan Bell
(06/01/2007 01:00)

the Calc UNO API starts at 0,0 getCellByPosition is certainly zero based.

It might well be 1 based in the on disk ODF though. Another curious difference between Calc and Excel is that in calc you specify x,y but in Excel it is y,x. This means that in calc you might get a handle to cell E7 by doing something like sheet.getCellByPosition(4,6) but in Excel that would be sheet.Cells(7,5).

I don't know much about the C API interfaces to things so you might well be using different APIs to me.


538.4. Alan Bell
(06/01/2007 07:15)

You are absolutely right. To the user of the spreadsheet, the rows always start with 1, and most people consider A to be the 1st letter of the alphabet rather than the 0th. I guess what was important to me was making an API which worked the same for both Excel and Calc so that the code populating the spreadsheet could be written just once to support both applications. Most of the time I fill up row 1 with column lables and column A with row lables then reference cells by looking up the position of the lables rather than by their actual numbers. It does bother me a bit that putting something in row 3 actually ends up on what is labled row 4. Maybe I should have a option base flag to make it all 1 based and leave the decision to the user.