poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 53517] New: Row iteration on formatted Sheet raise Nullpointer Exception
Date Sat, 07 Jul 2012 11:21:17 GMT
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


Mime
View raw message