https://bz.apache.org/bugzilla/show_bug.cgi?id=63554

            Bug ID: 63554
           Summary: XSSFName.getSheetName() returns wrong sheet
           Product: POI
           Version: 3.17-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

(unfortunately, I cannot attach an example of document for security reasons)
(might be related to https://bz.apache.org/bugzilla/show_bug.cgi?id=45430, BUT
is reproduced in POI 3.15)

Let's say I have to parse a document with named cells and that I have no
influence on the design/structure of a document itself.

I have to extract a named cell from Workbook. Let's say xl/workbook.xml has
following entries:

<definedName name="someName" localSheetId="20">someSheet!$B$21</definedName>
<definedName name="someName" localSheetId="6">someSheet!$B$21</definedName>
<definedName name="someName" localSheetId="4">someSheet!$B$21</definedName>
<definedName name="someName">someSheet!$B$21</definedName>

'someSheet' has idx == 15.

XSSFName name = Workbook.getName("someName")
name.getSheetIndex() uses localSheetId and returns "20", which refers to a
wrong sheet.

Current workaround:
new CellReference(name.getRefersToFormula()).getSheetIndex() returns expected
index (15)

-- 
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]

Reply via email to