Skip to content
Open
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
16 changes: 15 additions & 1 deletion Source/HtmlRenderer/Core/Dom/CssLayoutEngineTable.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -611,6 +611,7 @@ private void LayoutCells(RGraphics g)
double cury = starty;
double maxRight = startx;
double maxBottom = 0f;
double maxHeaderBottom = 0f;
int currentrow = 0;

// change start X by if the table should align to center or right
Expand All@@ -634,6 +635,7 @@ private void LayoutCells(RGraphics g)
for (int j = 0; j < row.Boxes.Count; j++)
{
CssBox cell = row.Boxes[j];
var isHeader = cell.HtmlTag != null && cell.HtmlTag.Name == "th";
if (curCol >= _columnWidths.Length)
break;

Expand All@@ -660,6 +662,11 @@ private void LayoutCells(RGraphics g)
maxRight = Math.Max(maxRight, cell.ActualRight);
curCol++;
curx = cell.ActualRight + GetHorizontalSpacing();

if (isHeader)
{
maxHeaderBottom = maxBottom;
}
}

foreach (CssBox cell in row.Boxes)
Expand DownExpand Up@@ -708,6 +715,13 @@ private void LayoutCells(RGraphics g)
maxRight = Math.Max(maxRight, _tableBox.Location.X + _tableBox.ActualWidth);
_tableBox.ActualRight = maxRight + GetHorizontalSpacing() + _tableBox.ActualBorderRightWidth;
_tableBox.ActualBottom = Math.Max(maxBottom, starty) + GetVerticalSpacing() + _tableBox.ActualBorderBottomWidth;

if (_headerBox != null)
{
_headerBox.Location = _tableBox.Location;
_headerBox.ActualRight = maxRight + GetHorizontalSpacing() + _headerBox.ActualBorderRightWidth;
_headerBox.ActualBottom = Math.Max(maxHeaderBottom, starty) + GetVerticalSpacing() + _headerBox.ActualBorderBottomWidth;
}
}

/// <summary>
Expand DownExpand Up@@ -1036,4 +1050,4 @@ private double GetVerticalSpacing()

#endregion
}
}
}
Loading