Skip to content

Commit 74e6297

Browse files
committed
Update min max table width calculation
DEVSIX-1252
1 parent b7b70a8 commit 74e6297

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

layout/src/main/java/com/itextpdf/layout/renderer/TableRenderer.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,8 +1157,9 @@ protected Float retrieveWidth(float parentBoxWidth) {
11571157
@Override
11581158
MinMaxWidth getMinMaxWidth(float availableWidth) {
11591159
initializeTableLayoutBorders();
1160-
1161-
TableWidths tableWidths = new TableWidths(this, availableWidth, true, bordersHandler.getRightBorderMaxWidth(), bordersHandler.getLeftBorderMaxWidth());
1160+
float rightMaxBorder = bordersHandler.getRightBorderMaxWidth();
1161+
float leftMaxBorder = bordersHandler.getLeftBorderMaxWidth();
1162+
TableWidths tableWidths = new TableWidths(this, availableWidth, true, rightMaxBorder, leftMaxBorder);
11621163
float[] columns = tableWidths.layout();
11631164
float minWidth = tableWidths.getMinWidth();
11641165
cleanTableLayoutBorders();
@@ -1167,7 +1168,8 @@ MinMaxWidth getMinMaxWidth(float availableWidth) {
11671168
for (float column : columns) {
11681169
maxColTotalWidth += column;
11691170
}
1170-
float additionalWidth = (float) this.getPropertyAsFloat(Property.MARGIN_RIGHT) + (float) this.getPropertyAsFloat(Property.MARGIN_LEFT);
1171+
float additionalWidth = (float) this.getPropertyAsFloat(Property.MARGIN_RIGHT) + (float) this.getPropertyAsFloat(Property.MARGIN_LEFT)
1172+
+ rightMaxBorder / 2 + leftMaxBorder / 2;
11711173
return new MinMaxWidth(additionalWidth, availableWidth, minWidth, maxColTotalWidth);
11721174
}
11731175

0 commit comments

Comments
 (0)