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 2012/07/07 13:21:17 UTC
[Bug 53517] New: Row iteration on formatted Sheet raise Nullpointer
Exception
https://issues.apache.org/bugzilla/show_bug.cgi?id=53517
Priority: P2
Bug ID: 53517
Assignee: dev@poi.apache.org
Summary: Row iteration on formatted Sheet raise Nullpointer
Exception
Severity: normal
Classification: Unclassified
Reporter: info@rublack.org
Hardware: PC
Status: NEW
Version: 3.7
Component: XSSF
Product: POI
Created attachment 29037
--> https://issues.apache.org/bugzilla/attachment.cgi?id=29037&action=edit
formatted Template
If using a formatted sheet as template and e.g setting row.height at Row 510
raise nullpointer exception when iterate over rows using LastRowNr.
Code:
for (int i=0; i <= workbook.getSheet("template").getLastRowNum(); i++)
{
Row actRow = workbook.getSheet("template").getRow(i);
}
because it looks like a empty sheet hast normally only 500 rows and formatting
a row after 500 at this row to the row list.
Now the row treeMap has 501 entries, with keys 0 to 499 and the additional key
510
from the formatted row as entry 501 .
Calling workbook.getSheetAt(0).getLastRowNum() get the key 510 and iterate like
above raise Nullpointer in workbook.getSheetAt(0).getRow(i) because keys 500 to
509 are not in the treeMap.
I put the template file as attachment
--
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 53517] Row iteration on formatted Sheet raise Nullpointer
Exception
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53517
Nick Burch <ni...@alfresco.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |INVALID
OS| |All
--- Comment #1 from Nick Burch <ni...@alfresco.com> ---
The Excel file format is a sparse format. If rows aren't used, and have never
been used, then they'll never be present in the file
If you only want defined rows, then use the RowIterator on a sheet. If you you
iterate between the FirstRowNum and LastRowNum, then you need to check that the
row isn't null before using it. See the website for more info on all of this
--
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 53517] Row iteration on formatted Sheet raise Nullpointer
Exception
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53517
--- Comment #2 from Ralf Rublack <in...@rublack.org> ---
Hi Nick,
thx for your hint
--
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