Skip to content

Commit 0a0128e

Browse files
committed
Fix issue with property inheritence during min max width calculation
DEVSIX-1252 Autoported commit. Original commit hash: [7fd4228]
1 parent ba98bf0 commit 0a0128e

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

itext/itext.layout/itext/layout/renderer/TableWidths.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,7 @@ private void CalculateMinMaxWidths() {
598598
float[] minWidths = new float[numberOfColumns];
599599
float[] maxWidths = new float[numberOfColumns];
600600
foreach (TableWidths.CellInfo cell in cells) {
601-
// Why we need it? Header/Footer?
602-
cell.GetCell().SetParent(tableRenderer);
601+
cell.SetParent(tableRenderer);
603602
MinMaxWidth minMax = cell.GetCell().GetMinMaxWidth(MinMaxWidthUtils.GetMax());
604603
float[] indents = GetCellBorderIndents(cell);
605604
minMax.SetAdditionalWidth(minMax.GetAdditionalWidth() + indents[1] / 2 + indents[3] / 2);
@@ -883,6 +882,20 @@ public override String ToString() {
883882
}
884883
return str;
885884
}
885+
886+
public virtual void SetParent(TableRenderer tableRenderer) {
887+
if (region == HEADER) {
888+
cell.SetParent(tableRenderer.headerRenderer);
889+
}
890+
else {
891+
if (region == FOOTER) {
892+
cell.SetParent(tableRenderer.footerRenderer);
893+
}
894+
else {
895+
cell.SetParent(tableRenderer);
896+
}
897+
}
898+
}
886899
}
887900
//endregion
888901
}

0 commit comments

Comments
 (0)