Created attachment 22964 [details] excel template I start on Trying to create an outlined excel spreadsheet I got the following exception. With the 3.1-FINAL everything work fine. Consider that: 1) I start from an existing template (attached); 2) I need to report sum on top, then I used sheet.setRowSumsBelow(false) and sheet.setAlternativeExpression(false), but, by comment those lines the problem still occurs. Caused by: java.lang.IllegalArgumentException: Specified rowIndex 30 is outside the allowable range (0..30) at org.apache.poi.hssf.record.aggregates.ValueRecordsAggregate.removeAllCellsValuesForRow(ValueRecordsAggregate.java:111) at org.apache.poi.hssf.record.aggregates.RowRecordsAggregate.removeRow(RowRecordsAggregate.java:120) at org.apache.poi.hssf.model.Sheet.addRow(Sheet.java:677) at org.apache.poi.hssf.usermodel.HSSFSheet.addRow(HSSFSheet.java:303) at org.apache.poi.hssf.usermodel.HSSFSheet.createRow(HSSFSheet.java:206) at it.mef.scai.shared.poiutils.ExcelUtil.inserisciValore(ExcelUtil.java:393) at it.mef.scai.paf.service.printexport.impl.GestioneFabbisogniExcelRenderServiceImpl.renderElement(GestioneFabbisogniExcelRenderServiceImpl.java:116) at it.mef.scai.paf.service.printexport.impl.GestioneFabbisogniExcelRenderServiceImpl.renderElement(GestioneFabbisogniExcelRenderServiceImpl.java:133) at it.mef.scai.paf.service.printexport.impl.GestioneFabbisogniExcelRenderServiceImpl.renderElement(GestioneFabbisogniExcelRenderServiceImpl.java:133) at it.mef.scai.paf.service.printexport.impl.GestioneFabbisogniExcelRenderServiceImpl.renderElement(GestioneFabbisogniExcelRenderServiceImpl.java:133) at it.mef.scai.paf.service.printexport.impl.GestioneFabbisogniExcelRenderServiceImpl.renderElement(GestioneFabbisogniExcelRenderServiceImpl.java:133) at it.mef.scai.paf.service.printexport.impl.ExcelTreeViewRenderServiceImpl.renderExcelTreeView(ExcelTreeViewRenderServiceImpl.java:58) ... 78 more
Created attachment 22965 [details] abstract base excel render service impl
Created attachment 22966 [details] concrete excel export class
Created attachment 22967 [details] General purpose utilities.
Fixed in svn r722206. Next time can you try to simplify your example code that you upload. This bug can actually be shown with just 4 lines of code: HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet(); HSSFRow row = sheet.createRow(30); row = sheet.createRow(30); // << throws IllegalArgumentException -- Adding a cell to the row before the second call to createRow() makes the bug go away. So your code must have been creating rows multiple times before adding cells. In any case, POI supports this usage now.