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 2017/07/26 04:11:55 UTC
[Bug 61343] New: Sheet.getFirstRowNum() returns first non empty row
https://bz.apache.org/bugzilla/show_bug.cgi?id=61343
Bug ID: 61343
Summary: Sheet.getFirstRowNum() returns first non empty row
Product: POI
Version: 3.16-FINAL
Hardware: PC
Status: NEW
Severity: major
Priority: P2
Component: POI Overall
Assignee: dev@poi.apache.org
Reporter: mayur.anchalia@gmail.com
Target Milestone: ---
Created attachment 35173
--> https://bz.apache.org/bugzilla/attachment.cgi?id=35173&action=edit
Sample spreadsheet
I have a spreadsheet with cell (3,6) i.e 3rd row and 6th column being populated
with some data. All other rows and columns of the sheet are empty.
While trying to read the Spreadsheet,
we use the function:
sheet.getFirstRowNum() which returns 2 in this case. Expected value
is 0 as the sheet start from 0th row.
sheet.getRow() for 0th index returns null, ideally it should return row object
with empty value.
--
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 61343] Sheet.getFirstRowNum() returns first non empty row
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61343
--- Comment #2 from Javen O'Neal <on...@apache.org> ---
Refer to the Spreadsheet Quick Guide and examples for how to handle worksheets
that may contain empty rows or cells.
This is what you're looking for to return an empty row from a worksheet that
does not contain that row:
static Row getOrCreateRow(Sheet sheet, int rowIndex) {
Row row = sheet.getRow(2);
if (row == null) {
row = sheet.createRow(2);
}
return row;
}
Conveniently, theres a function that is very similar to this in
org.apache.poi.ss.util.CellUtil.
--
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 61343] Sheet.getFirstRowNum() returns first non empty row
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61343
Javen O'Neal <on...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
OS| |All
Resolution|--- |INVALID
Status|NEW |RESOLVED
--- Comment #1 from Javen O'Neal <on...@apache.org> ---
The OOXML format allows for rows or cells to be missing. This is allows for
sheets to be sparse, consuming less memory and tim to load, and less time to
iterate through all the non-empty rows and cells.
The function getFirstRowNum() behaves as expected and documented in the
Javadocs.
By the way, the same is true for getLastRowNum().
--
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