Bug 55280: Don't repeatedely fetch the size of the CTMergeCells object as this is a costly operation with XMLBeans

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1621631 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2014-08-31 19:53:53 +00:00
parent 809ec00a7d
commit 3eec314719

View File

@ -1579,8 +1579,9 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
public void removeMergedRegion(int index) {
CTMergeCells ctMergeCells = worksheet.getMergeCells();
CTMergeCell[] mergeCellsArray = new CTMergeCell[ctMergeCells.sizeOfMergeCellArray() - 1];
for (int i = 0 ; i < ctMergeCells.sizeOfMergeCellArray() ; i++) {
int size = ctMergeCells.sizeOfMergeCellArray();
CTMergeCell[] mergeCellsArray = new CTMergeCell[size - 1];
for (int i = 0 ; i < size ; i++) {
if (i < index) {
mergeCellsArray[i] = ctMergeCells.getMergeCellArray(i);
}