You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2015/04/28 22:30:38 UTC

[Bug 57869] New: getRow() returns null even when there is data

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

            Bug ID: 57869
           Summary: getRow() returns null even when there is data
           Product: POI
           Version: 3.11-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
          Assignee: dev@poi.apache.org
          Reporter: ashok.ravi@cognizant.com

Im trying read a excel using HSSF which is a standard template used for
populating the logs. But getRow() on the sheet object is returning a null value
which looks weird. Here's my snippet:


fs     = new NPOIFSFileSystem( new File( filePath + templateFile ), true );
wb     = new HSSFWorkbook( fs.getRoot(), true );
sheet     = wb.getSheetAt(0); //get first worksheet

//The following method is called to populate the sheet
populateLogFields( "", sheet.getRow(15) ); //Bank LOCKBX


The above line is getting failed which is getting the row as null. Not sure why
it behaves like this. Kindly do review it from your end.


Thanks,
Ashok R

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


[Bug 57869] getRow() returns null even when there is data

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57869

Nick Burch <ap...@gagravarr.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED
                 OS|                            |All

--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---
Rows in POI are 0-based not 1-based, so for row 15 in Excel, you need to call
getRow(14)

Additionally, fetching sheet by name might be safer, in case there are hidden
sheets before the one you think is the first

Otherwise, if that isn't the problem, please re-open and upload a file that
shows the problem, along with a small junit unit test that shows it, and we'll
take a look

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