https://bz.apache.org/bugzilla/show_bug.cgi?id=59670
Bug ID: 59670
Summary: Sheet.getRow().getCell() gets the value from the next
sheet along
Product: POI
Version: 3.14-FINAL
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: HSSF
Assignee: [email protected]
Reporter: [email protected]
When using the HSSF library when I print the current sheet name it prints the
correct one. If I then get the cell value of a known cell in that sheet it will
return the value of the cell in the next sheet along.
How I get the sheet:
private static Sheet getSheet(Workbook wb, String sheetName){
Sheet s = null;
int numberOfSheets = workbook.getNumberOfSheets();
for (int i = 0; i < numberOfSheets; i++) {
s = wb.getSheet(sheetName);
if( s.getSheetName().equals(sheetName)){
return s;
}
}
return s;
}
How I get the cell value:
private static double getCellValue(Cell cell) {
switch (cell.getCellType()) {
case Cell.CELL_TYPE_NUMERIC:
return cell.getNumericCellValue();
case Cell.CELL_TYPE_BLANK:
return 0;
}
return 0;
}
double DOLabour = getCellValue(s.getRow(16).getCell(4));
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]