Hi Guys,
I am total newbe but i have to know how to read named range in apache poi.
I am trying only to read value for named range.
I am using code like:
and my error is :
Exception in thread "main" java.lang.IllegalArgumentException: Specified name index -1 is outside the allowable range (0..0).
Can you help me how to fix this ?
Best,
Jacek
I am total newbe but i have to know how to read named range in apache poi.
I am trying only to read value for named range.
I am using code like:
Code:
public static void main(String[] args) throws IOException {
// setup code
String cname = "TestName";
org.apache.poi.ss.usermodel.Workbook wb = null;
try {
wb = WorkbookFactory.create(new File("C:\\Users\\admin\\Desktop\\Example Variable3.xlsm"));
} catch (EncryptedDocumentException | InvalidFormatException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
int namedCellIdx = wb.getNameIndex("TestVariable");
System.out.println(namedCellIdx);
org.apache.poi.ss.usermodel.Name aNamedCell = wb.getNameAt(namedCellIdx);
System.out.println(aNamedCell);
}
}
Quote:
Exception in thread "main" java.lang.IllegalArgumentException: Specified name index -1 is outside the allowable range (0..0).
Best,
Jacek