Free Support Forum - aspose.com

Exception in java

Hi,

I’m getting the following exception in calling insertRows. At a guess
it looks as though your insert operation is expecting a cell area to be
set up with columns, but insertRow only takes rows as an argument. So
I’d guess you have an initialization bug, or you expected me to have
done something with cells prior to this point.

This occurs with latest download - 1.7.4.



xception in thread “main” java.lang.IllegalArgumentException: Invalid column index: -1

at com.aspose.cells.aD.d(Unknown Source)

at com.aspose.cells.CellArea.(Unknown Source)

at com.aspose.cells.Cells.l(Unknown Source)

at com.aspose.cells.Cells.insertRows(Unknown Source)

at optrak.datatransform.actions.NameRangeMultiRecordWriteAction.init(NameRangeMultiRecordWriteAction.java



My code is:

Cells cells = worksheet.getCells();

int nCurrentDataRows = 1 + rowData.getEndRow() - rowData.getStartRow();

int nRows = model.getRowCount();

if (totalsData != null)

{

if (nRows > nCurrentDataRows)

{

int totalTop = totalsData.getStartRow();

// move the totals area cells down

cells.insertRows(totalTop, nRows - nCurrentDataRows);<br>

The parameters for insertRows are 2 and 3.




It seems that this problem occurs when updating references in named ranges. Could you post your template file here? Thank you.

Laurence,

OK. I’m not using your template mechanism, you realize?



Tim


Hi Tim,

Thanks for your information.

Now it's 9PM in my place. So our developers cannot check this problem right now. They will debug this issue as soon as they come back work next Monday.

Hi Tim,

Please try this fix.

That works fine.
Thanks