Skip to content

Commit

Permalink
opensagres#682 Fixed bug opensagres#2 in previous solution.
Browse files Browse the repository at this point in the history
  • Loading branch information
imajic committed Jul 13, 2024
1 parent 9a75575 commit 0fe62f0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,28 @@ public void endTableHeaderRows()
inTableHeaderRows = false;
}

private void fitCellIntoSpansFromAbove(PdfPCell cell) {
int rowSpan = cell.getRowspan();
int colSpan = cell.getColspan();

// skip all the cell places already spanned from above
private void skipSpannedFromAbove(){
// skips all the cell places already spanned from above
do {
if (spansFromAboveIdx < getNumberOfColumns() && spansFromAbove[spansFromAboveIdx] > 0) {
spansFromAbove[spansFromAboveIdx]--;
spansFromAboveIdx++;
}
if (spansFromAboveIdx >= getNumberOfColumns()) {
// we have no more place in the current row; finish it up, and start a new one
// we have no more place in the current row; finish it up,
endTableRow();
beginTableRow(currentRowStyle);
}
}
while (spansFromAbove[spansFromAboveIdx] > 0);
while (!reachedEndOfRow() && spansFromAbove[spansFromAboveIdx] > 0);
}

private void fitCellIntoSpansFromAbove(PdfPCell cell) {
int rowSpan = cell.getRowspan();
int colSpan = cell.getColspan();

// skip all the cell places already spanned from above
skipSpannedFromAbove();

for (int col = 0; col < colSpan; col++){
if (spansFromAbove[spansFromAboveIdx] > 0){
Expand All @@ -113,6 +118,9 @@ private void fitCellIntoSpansFromAbove(PdfPCell cell) {
}
spansFromAboveIdx++;
}

// skip all the cell places already spanned from above
skipSpannedFromAbove();
}

private boolean reachedEndOfRow(){
Expand Down
Binary file not shown.

0 comments on commit 0fe62f0

Please sign in to comment.