You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2003/08/26 05:20:06 UTC

DO NOT REPLY [Bug 22720] New: - Exception occurs when deleting merged cells from cloned sheet

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22720>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22720

Exception occurs when deleting merged cells from cloned sheet

           Summary: Exception occurs when deleting merged cells from cloned
                    sheet
           Product: POI
           Version: 2.0-pre3
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: HSSF
        AssignedTo: poi-dev@jakarta.apache.org
        ReportedBy: huri@users.sourceforge.net


I clone a worksheet with merged cells, and then delete the merged cells from 
the clone:

HSSFSheet sheet = workBook.cloneSheet(templateSheetIndex);

for (int i=sheet.getNumMergedRegions()-1; i>=0; i--) {
  sheet.removeMergedRegion(i);
}

This results in:

java.lang.IndexOutOfBoundsException: Index: 157, Size: 41
	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)

Index and size shown in the error message doesn't make sense because the 
source sheet only has 4 merged cells.

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