DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=44417>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=44417

           Summary: CellReference.getSheetName() returns a String which
                    HSSFSheet.getSheet() does not find
           Product: POI
           Version: 3.0
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: major
          Priority: P2
         Component: HSSF
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


Following the example from

http://poi.apache.org/hssf/quick-guide.html#NamedRanges

I have the following code:

    int cellIndex = workbook.getNameIndex(cellName);
    HSSFName name = workbook.getNameAt(cellIndex);
    AreaReference aref = new AreaReference(name.getReference());
    // assume a single cell in named area
    CellReference cref = aref.getAllReferencedCells()[0];
    log.debug(cellName + ": " +
              cref.getSheetName() + ", " + cref.getRow() +
              ", " + cref.getCol());
    HSSFSheet s = workbook.getSheet(cref.getSheetName());

Unfortunately, the getSheet() call returns null.  In the logging line above,
getSheetName() shows single quotes around the name.  If I remove those single
quotes, the getSheet() call works correctly.

i.e.:

    HSSFSheet s = workbook.getSheet(cref.getSheetName().replaceAll("'", ""));

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to