diff --git a/src/java/org/apache/poi/ss/util/SheetUtil.java b/src/java/org/apache/poi/ss/util/SheetUtil.java index 31d470043..9a258d35b 100644 --- a/src/java/org/apache/poi/ss/util/SheetUtil.java +++ b/src/java/org/apache/poi/ss/util/SheetUtil.java @@ -104,8 +104,7 @@ public class SheetUtil { int column = cell.getColumnIndex(); int colspan = 1; - for (int i = 0 ; i < sheet.getNumMergedRegions(); i++) { - CellRangeAddress region = sheet.getMergedRegion(i); + for (CellRangeAddress region : sheet.getMergedRegions()) { if (containsCell(region, row.getRowNum(), column)) { if (!useMergedCells) { // If we're not using merged cells, skip this one and move on to the next. @@ -335,8 +334,7 @@ public class SheetUtil { } } - for (int mr=0; mr