The documentation says HSSFWorkbook.getSheetIndex(sheetName) returns -1 when
the given sheet name does not exist. But for some reason its returning "0" when
the supplied name is "Sheet1" AND the workbook is empty. Strangely, it _only_
seems to happen when the name is "Sheet1". Change the name to "Sheet0" or
"Abracadabra" and the method returns the expected -1. What is my tired brain
missing :) ?
jvm 1.6 / poi-3.7-20101029.jar
Example:
String sheetName = "Sheet1";
Workbook wb = new HSSFWorkbook();
System.out.println("getNumberOfSheets = "+ wb.getNumberOfSheets());
System.out.println("getSheetIndex("+ sheetName +") = "+
wb.getSheetIndex(sheetName));
Results:
getNumberOfSheets = 0
getSheetIndex(Sheet1) = 0 <=== should be -1
========================
-Leigh
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]