Le 02/05/2013 14:10, Frank Ho a écrit :
Hi All,

   I used next code to get row and column of cell in cell range :

  sheet.getSpreadSheet().getTableModel("test3").getCellAt(0, 0).getX();

  "test3" is the named range.  I want to get the row and column of 1st cell.
( Assume its row and column are 2 and 5 )

   but there was exception when execute "getCellAt(0, 0)" if this cell is
empty :



Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 5,
Size: 4

at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at org.jopendocument.dom.spreadsheet.Row.getCellAt(Unknown Source)
at org.jopendocument.dom.spreadsheet.Row.getValidCellAt(Unknown Source)
at org.jopendocument.dom.spreadsheet.Row.getMutableCellAt(Unknown Source)
at org.jopendocument.dom.spreadsheet.Table.getCellAt(Unknown Source)
at 
org.jopendocument.dom.spreadsheet.SheetTableModel$MutableTableModel.getCellAt(Unknown
 Source)
at com.icil.testing.Temp3.main(Temp3.java:25)


  if this cell is not empty, then there is not exception.
  why?

Hi,

From what I can see, the table has only 4 columns. If the cell is empty, LibreOffice might optimize and not save the last empty columns.

how can I can get the row and column of cell in cell range if this cell is 
empty?

Apparently, you can't right now but you will be able to use the new SpreadSheet.getRange() method in the next release of jOpenDocument.

Cheers,
Sylvain

--

--- You received this message because you are subscribed to the Google Groups "jOpenDocument" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to