You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Xuemin Guan <xu...@appresso.com> on 2003/08/27 12:46:32 UTC

Can't shift No. zero row

Dear all,

I am using HSSFSheet.shiftRows(int begin, int last, int numOfRows)
to shift rows so that I can insert a row. It worked find until
I tried to shift No. zero row, the code lools like:

//shift the rows between No. zero and No. 20 1 row down
hssfSheet.shiftRows(0, 20, 1);

I was bitten by the following exception:


java.lang.IndexOutOfBoundsException: Index: 2089, Size: 36
at java.util.ArrayList.RangeCheck(ArrayList.java:508)
at java.util.ArrayList.remove(ArrayList.java:388)
at org.apache.poi.hssf.model.Sheet.removeMergedRegion(Sheet.java:506)
at 
org.apache.poi.hssf.usermodel.HSSFSheet.removeMergedRegion(HSSFSheet.java:564)
at org.apache.poi.hssf.usermodel.HSSFSheet.shiftMerged(HSSFSheet.java:925)
at org.apache.poi.hssf.usermodel.HSSFSheet.shiftRows(HSSFSheet.java:990)
at org.apache.poi.hssf.usermodel.HSSFSheet.shiftRows(HSSFSheet.java:957)
.....

Any ideas on this? Or there is another better way to insert a row?

Thanks a lot,

Xuemin Guan


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org


RE: Can't shift No. zero row

Posted by Shawn Laubach <sh...@cox.net>.
It's not just shifting from row 0.  One of the test cases looks at this.
Also looking at the stack trace, it looks like it may be when merged regions
are involved.  Please enter a bug in and attach the smallest piece of
offending code and an xls file it fails on.

Shawn

-----Original Message-----
From: Xuemin Guan [mailto:xuemin@appresso.com]
Sent: Wednesday, August 27, 2003 9:24 AM
To: POI Users List
Subject: Re: Can't shift No. zero row


Have tried both 2.0-pre2 and 2.0-pre3, and both
of them have the same problem.

Best,

Xuemin
----- Original Message -----
From: "Danny Mui" <da...@muibros.com>
To: "POI Users List" <po...@jakarta.apache.org>
Sent: Wednesday, August 27, 2003 11:11 PM
Subject: Re: Can't shift No. zero row


> What version is this?
>
> Xuemin Guan wrote:
>
> > Dear all,
> >
> > I am using HSSFSheet.shiftRows(int begin, int last, int numOfRows)
> > to shift rows so that I can insert a row. It worked find until
> > I tried to shift No. zero row, the code lools like:
> >
> > //shift the rows between No. zero and No. 20 1 row down
> > hssfSheet.shiftRows(0, 20, 1);
> >
> > I was bitten by the following exception:
> >
> >
> > java.lang.IndexOutOfBoundsException: Index: 2089, Size: 36
> > at java.util.ArrayList.RangeCheck(ArrayList.java:508)
> > at java.util.ArrayList.remove(ArrayList.java:388)
> > at org.apache.poi.hssf.model.Sheet.removeMergedRegion(Sheet.java:506)
> > at
> >
org.apache.poi.hssf.usermodel.HSSFSheet.removeMergedRegion(HSSFSheet.java:56
4)
> >
> > at
> > org.apache.poi.hssf.usermodel.HSSFSheet.shiftMerged(HSSFSheet.java:925)
> > at org.apache.poi.hssf.usermodel.HSSFSheet.shiftRows(HSSFSheet.java:990)
> > at org.apache.poi.hssf.usermodel.HSSFSheet.shiftRows(HSSFSheet.java:957)
> > .....
> >
> > Any ideas on this? Or there is another better way to insert a row?
> >
> > Thanks a lot,
> >
> > Xuemin Guan
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: poi-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org


Re: Can't shift No. zero row

Posted by Xuemin Guan <xu...@appresso.com>.
Have tried both 2.0-pre2 and 2.0-pre3, and both
of them have the same problem.

Best,

Xuemin
----- Original Message ----- 
From: "Danny Mui" <da...@muibros.com>
To: "POI Users List" <po...@jakarta.apache.org>
Sent: Wednesday, August 27, 2003 11:11 PM
Subject: Re: Can't shift No. zero row


> What version is this?
>
> Xuemin Guan wrote:
>
> > Dear all,
> >
> > I am using HSSFSheet.shiftRows(int begin, int last, int numOfRows)
> > to shift rows so that I can insert a row. It worked find until
> > I tried to shift No. zero row, the code lools like:
> >
> > //shift the rows between No. zero and No. 20 1 row down
> > hssfSheet.shiftRows(0, 20, 1);
> >
> > I was bitten by the following exception:
> >
> >
> > java.lang.IndexOutOfBoundsException: Index: 2089, Size: 36
> > at java.util.ArrayList.RangeCheck(ArrayList.java:508)
> > at java.util.ArrayList.remove(ArrayList.java:388)
> > at org.apache.poi.hssf.model.Sheet.removeMergedRegion(Sheet.java:506)
> > at
> >
org.apache.poi.hssf.usermodel.HSSFSheet.removeMergedRegion(HSSFSheet.java:56
4)
> >
> > at
> > org.apache.poi.hssf.usermodel.HSSFSheet.shiftMerged(HSSFSheet.java:925)
> > at org.apache.poi.hssf.usermodel.HSSFSheet.shiftRows(HSSFSheet.java:990)
> > at org.apache.poi.hssf.usermodel.HSSFSheet.shiftRows(HSSFSheet.java:957)
> > .....
> >
> > Any ideas on this? Or there is another better way to insert a row?
> >
> > Thanks a lot,
> >
> > Xuemin Guan
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: poi-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org


Re: Can't shift No. zero row

Posted by Danny Mui <da...@muibros.com>.
What version is this?

Xuemin Guan wrote:

> Dear all,
>
> I am using HSSFSheet.shiftRows(int begin, int last, int numOfRows)
> to shift rows so that I can insert a row. It worked find until
> I tried to shift No. zero row, the code lools like:
>
> //shift the rows between No. zero and No. 20 1 row down
> hssfSheet.shiftRows(0, 20, 1);
>
> I was bitten by the following exception:
>
>
> java.lang.IndexOutOfBoundsException: Index: 2089, Size: 36
> at java.util.ArrayList.RangeCheck(ArrayList.java:508)
> at java.util.ArrayList.remove(ArrayList.java:388)
> at org.apache.poi.hssf.model.Sheet.removeMergedRegion(Sheet.java:506)
> at 
> org.apache.poi.hssf.usermodel.HSSFSheet.removeMergedRegion(HSSFSheet.java:564) 
>
> at 
> org.apache.poi.hssf.usermodel.HSSFSheet.shiftMerged(HSSFSheet.java:925)
> at org.apache.poi.hssf.usermodel.HSSFSheet.shiftRows(HSSFSheet.java:990)
> at org.apache.poi.hssf.usermodel.HSSFSheet.shiftRows(HSSFSheet.java:957)
> .....
>
> Any ideas on this? Or there is another better way to insert a row?
>
> Thanks a lot,
>
> Xuemin Guan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org