| Code with Finding: |
class PdfPTable {
/**
* Checks if there are rows above belonging to a rowspan.
* @param currRow the current row to check
* @param currCol the current column to check
* @return true if there's a cell above that belongs to a rowspan
* @since 2.1.6
*/
boolean rowSpanAbove(final int currRow, final int currCol) {
if (currCol >= getNumberOfColumns()
|| currCol < 0
|| currRow < 1)
return false;
int row = currRow - 1;
PdfPRow aboveRow = rows.get(row);
if (aboveRow == null)
return false;
PdfPCell aboveCell = cellAt(row, currCol);
while (aboveCell == null && row > 0) {
aboveRow = rows.get(--row);
if (aboveRow == null)
return false;
aboveCell = cellAt(row, currCol);
}
int distance = currRow - row;
if (aboveCell.getRowspan() == 1 && distance > 1) {
int col = currCol - 1;
aboveRow = rows.get(row + 1);
distance--;
aboveCell = aboveRow.getCells()[col];
while (aboveCell == null && col > 0)
aboveCell = aboveRow.getCells()[--col];
}
return aboveCell != null && aboveCell.getRowspan() > distance;
}
}
|