Hi,
I am using current cvs version of poi fetched and compiled 03.03.2003.
What i am doing is loading excel template made with excel 2000 which
contains graphs and graphs values has been assigned to the named range.
below is simple printout example
int nameNum = workbook.getNumberOfNames();
for (int i = 0; i < nameNum; i++) {
HSSFName namedRef = workbook.getNameAt(i); System.out.println("cell ref
name: "+namedRef.getNameName()); System.out.println("Cell ref:" +
namedRef.getReference()); }
here is what i get if i call getReference
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: -2,
Size: 3
at java.util.ArrayList.RangeCheck(ArrayList.java:486)
at java.util.ArrayList.get(ArrayList.java:302)
at
org.apache.poi.hssf.model.Workbook.getSheetName(Workbook.java:449)
at
org.apache.poi.hssf.model.Workbook.findSheetNameFromExternSheet(Workbook.jav
a:1700)
at
org.apache.poi.hssf.model.Workbook.getSheetReferences(Workbook.java:1685)
at
org.apache.poi.hssf.usermodel.HSSFName.getReference(HSSFName.java:126)
everything is fine if i dont use named ranges with graphs. But i dont know
amount of data so i am trying to use named ranges as dynamic data source for
graphs.
another issue which come up with named ranges is that
if named area is bigger than one cell getting reference from it throws
following exception
CellReference cellRef = new CellReference(namedRef.getReference());
Cell ref = Sheet1!$A$1:$IV$2
Exception in thread "main" java.lang.NumberFormatException: 1:$IV$2
at java.lang.Integer.parseInt(Integer.java:418)
at java.lang.Integer.parseInt(Integer.java:458)
at
org.apache.poi.hssf.util.CellReference.<init>(CellReference.java:83)
at ReadWriteWorkbook.main(ReadWriteWorkbook.java:95)
Is there work arounds to get graphs working with dynamic named ranges ?.
Very Best regards,
Toni Penttinen
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]