diff --git a/thirdparties-extension/fr.opensagres.odfdom.converter.pdf.openpdf/src/main/java/fr/opensagres/odfdom/converter/pdf/internal/stylable/StylableTable.java b/thirdparties-extension/fr.opensagres.odfdom.converter.pdf.openpdf/src/main/java/fr/opensagres/odfdom/converter/pdf/internal/stylable/StylableTable.java index d97687d79..87e099d14 100644 --- a/thirdparties-extension/fr.opensagres.odfdom.converter.pdf.openpdf/src/main/java/fr/opensagres/odfdom/converter/pdf/internal/stylable/StylableTable.java +++ b/thirdparties-extension/fr.opensagres.odfdom.converter.pdf.openpdf/src/main/java/fr/opensagres/odfdom/converter/pdf/internal/stylable/StylableTable.java @@ -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){ @@ -113,6 +118,9 @@ private void fitCellIntoSpansFromAbove(PdfPCell cell) { } spansFromAboveIdx++; } + + // skip all the cell places already spanned from above + skipSpannedFromAbove(); } private boolean reachedEndOfRow(){ diff --git a/thirdparties-extension/fr.opensagres.odfdom.converter.pdf.openpdf/src/test/resources/org/odftoolkit/odfdom/converter/core/Issue682.odt b/thirdparties-extension/fr.opensagres.odfdom.converter.pdf.openpdf/src/test/resources/org/odftoolkit/odfdom/converter/core/Issue682.odt index 87fd77b36..a701f816d 100644 Binary files a/thirdparties-extension/fr.opensagres.odfdom.converter.pdf.openpdf/src/test/resources/org/odftoolkit/odfdom/converter/core/Issue682.odt and b/thirdparties-extension/fr.opensagres.odfdom.converter.pdf.openpdf/src/test/resources/org/odftoolkit/odfdom/converter/core/Issue682.odt differ