bug 58651: replace for-looped sheet.getMergedRegion(index) with sheet.getMergedRegions()

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1716362 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2015-11-25 11:48:17 +00:00
parent bd7568e16f
commit 3f3e519628
2 changed files with 3 additions and 7 deletions

View File

@ -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

View File

@ -46,10 +46,8 @@ public class ExcelToHtmlUtils extends AbstractExcelUtils
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 )
{