Bug 46312 - Specified rowIndex 30 is outside the allowable range (0..30)
Summary: Specified rowIndex 30 is outside the allowable range (0..30)
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.2-FINAL
Hardware: PC Windows XP
: P2 blocker (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-29 15:39 UTC by zzy9v4
Modified: 2008-12-01 12:06 UTC (History)
0 users



Attachments
excel template I start on (16.50 KB, application/octet-stream)
2008-11-29 15:39 UTC, zzy9v4
Details
abstract base excel render service impl (5.51 KB, application/octet-stream)
2008-11-29 15:40 UTC, zzy9v4
Details
concrete excel export class (9.96 KB, application/octet-stream)
2008-11-29 15:41 UTC, zzy9v4
Details
General purpose utilities. (12.61 KB, application/octet-stream)
2008-11-29 15:42 UTC, zzy9v4
Details

Note You need to log in before you can comment on or make changes to this bug.
Description zzy9v4 2008-11-29 15:39:22 UTC
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
Comment 1 zzy9v4 2008-11-29 15:40:41 UTC
Created attachment 22965 [details]
abstract base excel render service impl
Comment 2 zzy9v4 2008-11-29 15:41:12 UTC
Created attachment 22966 [details]
concrete excel export class
Comment 3 zzy9v4 2008-11-29 15:42:45 UTC
Created attachment 22967 [details]
General purpose utilities.
Comment 4 Josh Micich 2008-12-01 12:06:10 UTC
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.