poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 48923] New: Method Name.getSheetIndex() fails to return valid sheet index
Date Tue, 16 Mar 2010 16:38:41 GMT

           Summary: Method Name.getSheetIndex() fails to return valid
                    sheet index
           Product: POI
           Version: 3.6
          Platform: PC
        OS/Version: Windows 2000
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: wholder@nglm.com

Created an attachment (id=25136)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25136)
Test file for example code

In this example:

    InputStream inp = new FileInputStream("Book.xlsx");  // or .xls
    Workbook wb = WorkbookFactory.create(inp);
    int names = wb.getNumberOfNames() ;
    if (names > 0) {
      for (int ii = 0; ii < names; ii++) {
         Name name = wb.getNameAt(ii);
         String sName = name.getSheetName();
         //int nameIdx = name.getSheetIndex();        // Hmm... doesn't work
         int nameIdx = wb.getSheetIndex(sName);       // Alternate method

the commented out line always returns -1, even when the named cell, or range is
on a specific sheet.  The following line shows a workaround.  Note: this
also happens for .xls files.


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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org

View raw message