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=36956>. 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=36956 Summary: NullPointerException trying to place a page break Product: POI Version: 2.5 Platform: PC OS/Version: Windows XP Status: NEW Severity: normal Priority: P2 Component: HSSF AssignedTo: [email protected] ReportedBy: [EMAIL PROTECTED] This error only happens when trying to insert page break in an existing workbook, like in HSSFWorkbook book = new HSSFWorkbook(new FileInputStream(existingFileName)); HSSFSheet sheet = book.getSheetAt(0); sheet.setRowBreak(10); When doing same thing with a new workbook, it works: HSSFWorkbook book = new HSSFWorkbook(); HSSFSheet sheet = book.createSheet("Test"); sheet.setRowBreak(10); The reason is that the rowBreaks property of Sheet is only initialized for new sheets (the createSheet() call). If an existing sheet (createSheet(List, int, int) call) doesn't have any records for page breaks, then rowBreaks doesn't get initialized, resulting in an NPE. Possible resolution: either initialize rowBreaks during createSheet call, or do a null check in setRowBreak() -- 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] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
