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:
parent
2e795a5f26
commit
e8b2d5feb4
@ -104,8 +104,7 @@ public class SheetUtil {
|
|||||||
int column = cell.getColumnIndex();
|
int column = cell.getColumnIndex();
|
||||||
|
|
||||||
int colspan = 1;
|
int colspan = 1;
|
||||||
for (int i = 0 ; i < sheet.getNumMergedRegions(); i++) {
|
for (CellRangeAddress region : sheet.getMergedRegions()) {
|
||||||
CellRangeAddress region = sheet.getMergedRegion(i);
|
|
||||||
if (containsCell(region, row.getRowNum(), column)) {
|
if (containsCell(region, row.getRowNum(), column)) {
|
||||||
if (!useMergedCells) {
|
if (!useMergedCells) {
|
||||||
// If we're not using merged cells, skip this one and move on to the next.
|
// 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++) {
|
for (CellRangeAddress mergedRegion : sheet.getMergedRegions()) {
|
||||||
CellRangeAddress mergedRegion = sheet.getMergedRegion(mr);
|
|
||||||
if (mergedRegion.isInRange(rowIx, colIx)) {
|
if (mergedRegion.isInRange(rowIx, colIx)) {
|
||||||
// The cell wanted is in this merged range
|
// The cell wanted is in this merged range
|
||||||
// Return the primary (top-left) cell for the range
|
// Return the primary (top-left) cell for the range
|
||||||
|
@ -46,10 +46,8 @@ public class ExcelToHtmlUtils extends AbstractExcelUtils
|
|||||||
public static CellRangeAddress[][] buildMergedRangesMap( HSSFSheet sheet )
|
public static CellRangeAddress[][] buildMergedRangesMap( HSSFSheet sheet )
|
||||||
{
|
{
|
||||||
CellRangeAddress[][] mergedRanges = new CellRangeAddress[1][];
|
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;
|
final int requiredHeight = cellRangeAddress.getLastRow() + 1;
|
||||||
if ( mergedRanges.length < requiredHeight )
|
if ( mergedRanges.length < requiredHeight )
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user