Summary: | XSSFName.getSheetName() returns the wrong value | ||
---|---|---|---|
Product: | POI | Reporter: | Matthew <matthew.knl> |
Component: | HSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Attachments: |
Test Data
Macro-enabled workbook package structure My patch to solve "save macro-enabled workbook" issue, temporary solution |
Fixed in svn - was an issue when no localSheetId was given Created attachment 22287 [details]
Macro-enabled workbook package structure
Created attachment 22288 [details]
My patch to solve "save macro-enabled workbook" issue, temporary solution
(In reply to comment #2) > Created an attachment (id=22287) [details] > Macro-enabled workbook package structure > Sorry, this attachment is should be referred to bug#45430. (In reply to comment #3) > Created an attachment (id=22288) [details] > My patch to solve "save macro-enabled workbook" issue, temporary solution > Sorry, this attachment is should be referred to bug#45430. |
Created attachment 22279 [details] Test Data I am using POI 3.5 Beta 1. I write following code to list all the Named Range in the Excel Workbook. Workbook wb = new XSSFWorkbook(xlsx_path); for(int j=0; j<wb.getNumberOfNames(); j++){ Name name = wb.getNameAt(j); String reference = name.getReference(); String sheetName = name.getSheetName(); System.out.println("reference: " + reference); System.out.println("sheetName: " + sheetName); } I found that the .getSheetName() method return the wrong value, it always return sheet one name, which doesn't match with .getReference() (the sheet name part). I have uploaded a sample .xlsx file, which contains three worksheets, each worksheet $A$1 has defined a named range. You can run above codes to check the result. Expected Result: reference: SheetA!$A$1 sheetName: SheetA reference: SheetB!$A$1 sheetName: SheetB reference: SheetC!$A$1 sheetName: SheetC Actual Result: reference: SheetA!$A$1 sheetName: SheetA reference: SheetB!$A$1 sheetName: SheetA reference: SheetC!$A$1 sheetName: SheetA