html-generator
html-generator copied to clipboard
Table generation exemple
Is there any table generation sample code ?
public string GetHTMLstring()
{
var html = new HtmlDocument();
html.AddHead();
html.AddBody();
var head = html.Head;
var body = html.Body;
var table = new HtmlElement("table");
var thead = new HtmlElement("thead");
var tableItems = new HtmlElement("tr");
tableItems.Add(Tag
.Th
.WithInnerText("Item1"));
tableItems.Add(Tag
.Th
.WithInnerText("Item2"));
tableItems.Add(Tag
.Th
.WithInnerText("Item2"));
thead.Add(tableItems);
table.Add(thead);
head.Add(Tag
.Title
.WithInnerText("Title"));
body.Add(Tag
.H1
.WithInnerText("Hello"));
body.Add(Tag
.P
.WithInnerText("Message"));
body.Add(table);
return html.ToString();
}