Hi
/*
* Get column of a name range
*/
private static short getNamedRangeColumn (HSSFWorkbook wb, String name) {
int namedCellIdx = wb.getNameIndex(name);
HSSFName range = wb.getNameAt(namedCellIdx);
AreaReference ar = new AreaReference(range.getReference());
CellReference[] cells = ar.getAllReferencedCells();
// Store the column of the named range;
short rShort = cells[0].getCol();
// memory cleanup
range = null;
ar = null;
cells = null;
return rShort;
}
I upload template xls, and I got the following error:
java.lang.IllegalArgumentException: Invalid Formula cell reference:
'Tasks!D'
at org.apache.poi.hssf.util.CellReference.<init>(CellReference.java:61)
at org.apache.poi.hssf.util.AreaReference.<init>(AreaReference.java:63)
at
com.cypress.cyplm.servlet.AdminTaskSetEditAction.getNamedRangeColumn(AdminTaskSetEditAction.java:145)
at
com.cypress.cyplm.servlet.AdminTaskSetEditAction.processWorkbook(AdminTaskSetEditAction.java:171)
at
com.cypress.cyplm.servlet.AdminTaskSetEditAction.save(AdminTaskSetEditAction.java:593)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
the poi version we use is 3.1-FINAL, we just changed it back from 3.2. we do
not want to update poi to 3.2 cos it may bring other issues with our codes.
so the questions is, how to fix the issue? thanks