mirror of https://github.com/apache/poi.git
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
bd7568e16f
commit
3f3e519628
|
@ -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
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue