poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From one...@apache.org
Subject svn commit: r1716362 - in /poi/trunk/src: java/org/apache/poi/ss/util/SheetUtil.java scratchpad/src/org/apache/poi/hssf/converter/ExcelToHtmlUtils.java
Date Wed, 25 Nov 2015 11:48:18 GMT
Author: onealj
Date: Wed Nov 25 11:48:17 2015
New Revision: 1716362

URL: http://svn.apache.org/viewvc?rev=1716362&view=rev
Log:
bug 58651: replace for-looped sheet.getMergedRegion(index) with sheet.getMergedRegions()

Modified:
    poi/trunk/src/java/org/apache/poi/ss/util/SheetUtil.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToHtmlUtils.java

Modified: poi/trunk/src/java/org/apache/poi/ss/util/SheetUtil.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/SheetUtil.java?rev=1716362&r1=1716361&r2=1716362&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/util/SheetUtil.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/util/SheetUtil.java Wed Nov 25 11:48:17 2015
@@ -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<sheet.getNumMergedRegions(); mr++) {
-            CellRangeAddress mergedRegion = sheet.getMergedRegion(mr);
+        for (CellRangeAddress mergedRegion : sheet.getMergedRegions()) {
             if (mergedRegion.isInRange(rowIx, colIx)) {
                 // The cell wanted is in this merged range
                 // Return the primary (top-left) cell for the range

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToHtmlUtils.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToHtmlUtils.java?rev=1716362&r1=1716361&r2=1716362&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToHtmlUtils.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToHtmlUtils.java Wed Nov
25 11:48:17 2015
@@ -46,10 +46,8 @@ public class ExcelToHtmlUtils extends Ab
     public static CellRangeAddress[][] buildMergedRangesMap( HSSFSheet sheet )
     {
         CellRangeAddress[][] mergedRanges = new CellRangeAddress[1][];
-        for ( int m = 0; m < sheet.getNumMergedRegions(); m++ )
+        for ( final CellRangeAddress cellRangeAddress : sheet.getMergedRegions() )
         {
-            final CellRangeAddress cellRangeAddress = sheet.getMergedRegion( m );
-
             final int requiredHeight = cellRangeAddress.getLastRow() + 1;
             if ( mergedRanges.length < requiredHeight )
             {



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


Mime
View raw message