poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Danny Mui <da...@muibros.com>
Subject Re: Problem Removing Merged Regions
Date Fri, 09 Jan 2004 19:42:30 GMT
I believe these were fixed by RC2.  The clone fix should be in RC2.

Gabriel Chan wrote:
> I am having 2 problems when attempting to remove merged regions:
> 
> 1) If there is more than 1 merged region in a sheet, and I try to remove all
> of them, one merged region always remains:
> 
>         int numRegions = sheet.getNumMergedRegions();
> 
>         System.out.println("Initial number of merged regions: " +
> numRegions);
> 
>         for (int regionNum = 0; regionNum < numRegions; regionNum++)
>         {
>             sheet.removeMergedRegion(regionNum);
>             System.out.println("Removed region: "+ regionNum);
> 
>         }
> 
>         System.out.println("Final number of merged regions: " + numRegions);
> 
> 
>         If I run  the above code,  the number of merged region remaining is
> 1.
> 
> 2) If I clone a sheet with merged regions and delete the merged regions in
> the clone them I not only get problem 1, but also exceptions:
> 
> java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
>  at java.util.ArrayList.RangeCheck(ArrayList.java:507)
>  at java.util.ArrayList.remove(ArrayList.java:392)
>  at
> org.apache.poi.hssf.record.MergeCellsRecord.removeAreaAt(MergeCellsRecord.ja
> va:188)
>  at org.apache.poi.hssf.model.Sheet.removeMergedRegion(Sheet.java:496)
>  at
> org.apache.poi.hssf.usermodel.HSSFSheet.removeMergedRegion(HSSFSheet.java:56
> 4)
>  at
> org.apache.poi.hssf.usermodel.eq.HSSFUtil.removeAllRegionsFromSheet(HSSFUtil
> .java:252)
>  at
> org.apache.poi.hssf.usermodel.examples.ReadWriteWorkbook.main(ReadWriteWorkb
> ook.java:147)
> Exception in thread "main" Process terminated with exit code 1
> 
> ?????????
> Gabriel Chan
> Programmer Analyst
> #202, 12315 Stony Plain Road
> Edmonton Alberta
> Canada T5N 3Y8
> Telephone (780) 437-3020
> Fax (780) 462-6984
> Toll Free: 1-800-661-3306
> 
> 

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


Mime
View raw message