https://issues.apache.org/bugzilla/show_bug.cgi?id=45430
Summary: XSSFName.getSheetName() returns the wrong value
Product: POI
Version: unspecified
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: HSSF
AssignedTo: [email protected]
ReportedBy: [EMAIL PROTECTED]
Created an attachment (id=22279)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=22279)
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
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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]