Philip a écrit :
Hi Sylvain,
- I found I can only *modify* cells. Trying to *add* data beyond the
envelope of currently existing rows and columns leads to out-of-bound
errors.
You need to call Table.setColumnCount()/setRowCount() or if you have
many values merge().
How can I get a Table referring to a specific sheet?
Suppose I do
sh = getSheet ('Datasheet#1')
(where Datasheet#1 contains an unknown number of data)
Q.1: How do I get a handle to Table()? In the jOpenDocument javadocs I
see that sh.getTABLE() is -again- protected.
Sheet extends Table, you don't have to do anything (the method you're
referring to returns a namespace).
Q.2: How do I know what values to enter for setColumnCount() &
setRowCount(), knowing the array size to write but *not* knowing the
data size already present in the sheet.
getColumnCount()+array.length. If your data doesn't fill up the entire
sheet, then you can't : cf Q.3.
In other words, if I set setColumnCount or setRowCount too small, do I
run the risk that existing data will be truncated?
not if you use ensureColumnCount() instead of setColumnCount()
Q.3: In a more general sense, is there a method to find out the size
of existing data in a sheet, e.g. like Excel/VB's UsedRange()?
Not for the moment, but we'll look into it.
BTW I tried to search the svn but I can't find the link on the
jOpenDocument web page.
It is only available to paying customers, sorry.
HTH,
Sylvain.