Summary: | Sheet.getRow().getCell() gets the value from the next sheet along | ||
---|---|---|---|
Product: | POI | Reporter: | cbradford |
Component: | HSSF | Assignee: | POI Developers List <dev> |
Status: | NEW --- | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | 3.14-FINAL | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All | ||
Attachments: | Workbook |
Description
cbradford
2016-06-07 14:38:16 UTC
Please add also your example sheet Created attachment 33925 [details]
Workbook
Won't the logic of your sheet selection loop mean that if the name doesn't match, the last sheet will always be returned + used? Could that actually be the cause of your issue? If not, any chance you could turn your test code into a junit unit test that we can use with your attached file to investigate more? I have stepped through the code and if I am looking for the "PP1" sheet the function will return the "PP1" sheet and it will print this out using s.getSheetName(). When I then get the cell value using: 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)) It will actually return the value of the "Application" sheet not the "PP1" sheet. I have also noticed that when I loop through the sheets the first sheet is called "Module1" not "PP1". Have you had any further developments with this bug? (In reply to cbradford from comment #5) > Have you had any further developments with this bug? I had a quick try on this and can only confirm the bug. Althougn the bound name is correct, I suspect that the vba sheet is causing an error with the sheet references ... but maybe someone else with a deeper knowledge of hssf can jump in? |