Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#682 Fixed bug #2 in previous solution. #684

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.