diff --git a/fine-itext/src/com/fr/third/v2/lowagie/text/pdf/PdfPTable.java b/fine-itext/src/com/fr/third/v2/lowagie/text/pdf/PdfPTable.java index 5f0da78f3..199d21d6f 100644 --- a/fine-itext/src/com/fr/third/v2/lowagie/text/pdf/PdfPTable.java +++ b/fine-itext/src/com/fr/third/v2/lowagie/text/pdf/PdfPTable.java @@ -350,12 +350,14 @@ public class PdfPTable implements LargeElement { return; float total = 0; int numCols = getNumberOfColumns(); - float cellSpacings = tableProperties.isCollapse() ? 0 : tableProperties.getCellspacing(); - float borderWidth = tableProperties.getBorderStyle().getBorderWidth(); + BorderStyle borderStyle = tableProperties.getBorderStyle(); + float borderWidth = tableProperties.isCollapse() ? borderStyle.getBorderWidth() / 2 : borderStyle.getBorderWidth(); + float cellspacing = tableProperties.getCellspacing(); + float cellpadding = tableProperties.getCellpadding(); for (int k = 0; k < numCols; ++k) total += relativeWidths[k]; for (int k = 0; k < numCols; ++k) - absoluteWidths[k] = (totalWidth-(cellSpacings+ borderWidth)*(numCols+1)) * relativeWidths[k] / total; + absoluteWidths[k] = (totalWidth - cellspacing * (numCols + 1) - numCols * 2 * (borderWidth + cellpadding) - 2 * borderWidth) * relativeWidths[k] / total; } /** @@ -434,12 +436,13 @@ public class PdfPTable implements LargeElement { return 0; totalHeight = 0; BorderStyle borderStyle = tableProperties.getBorderStyle(); - float borderWidth = borderStyle.getBorderWidth(); + float borderWidth = tableProperties.isCollapse() ? borderStyle.getBorderWidth() / 2 : borderStyle.getBorderWidth(); float cellspacing = tableProperties.getCellspacing(); + float cellpadding = tableProperties.getCellpadding(); for (int k = 0; k < rows.size(); ++k) { totalHeight += getRowHeight(k, firsttime); } - totalHeight += (borderWidth + cellspacing) * (rows.size() + 1); + totalHeight += (rows.size() + 1) * 2 * borderWidth + cellpadding * 2 * rows.size() + (rows.size() + 1) * cellspacing; return totalHeight; } diff --git a/fine-itext/src/com/fr/third/v2/lowagie/text/pdf/TableProperties.java b/fine-itext/src/com/fr/third/v2/lowagie/text/pdf/TableProperties.java index 317f70fd4..2c7629908 100644 --- a/fine-itext/src/com/fr/third/v2/lowagie/text/pdf/TableProperties.java +++ b/fine-itext/src/com/fr/third/v2/lowagie/text/pdf/TableProperties.java @@ -19,7 +19,7 @@ public class TableProperties { } public float getCellspacing() { - return cellspacing; + return isCollapse() ? 0 : cellspacing; } public void setCellspacing(float cellspacing) {