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()
This appears to be fixed in the code in SVN. see code block below from Sheet: else if (rec.getSid() == PageBreakRecord.HORIZONTAL_SID) { retval.rowBreaks = (PageBreakRecord)rec; } else if (rec.getSid() == PageBreakRecord.VERTICAL_SID) { retval.colBreaks = (PageBreakRecord)rec; } Jason