Skip to content

Commit

Permalink
wpf: Implement colspan and rowspan support for table cells
Browse files Browse the repository at this point in the history
  • Loading branch information
mstefarov committed Jul 11, 2023
1 parent 02db273 commit cf0ee21
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ private static Block VisitBlock(MarkupNode node)
{
var cell = new TableCell();
ApplyStyle(cell, cellNode);

// Apply colspan and rowspan, for non-uniform tables
var attr = HtmlUtility.ParseAttributes(cellNode.Token?.Attributes);
if (attr.TryGetValue("colspan", out var colSpanStr) && byte.TryParse(colSpanStr, out var colSpan))
cell.ColumnSpan = colSpan;
if (attr.TryGetValue("rowspan", out var rowSpanStr) && byte.TryParse(rowSpanStr, out var rowSpan))
cell.RowSpan = rowSpan;

cell.Blocks.AddRange(VisitAndAddBlocks(cellNode.Children));
row.Cells.Add(cell);
}
Expand Down

0 comments on commit cf0ee21

Please sign in to comment.