AngleSharp by Florian Rappl

<PackageReference Include="AngleSharp" Version="0.2.9" />

.NET API 451,072 bytes

 HTMLTableElement

public sealed class HTMLTableElement : HTMLElement
Represents the HTML table element.
using AngleSharp.DOM.Collections; using AngleSharp.DOM.Css; namespace AngleSharp.DOM.Html { public sealed class HTMLTableElement : HTMLElement { public enum TableRules { None, Rows, Cols, Groups, All } public enum TableFrames { Void, Box, Above, Below, HSides, VSides, LHS, RHS, Border } internal const string Tag = "table"; [DOM("caption")] public HTMLTableCaptionElement Caption { get { return _children.QuerySelector<HTMLTableCaptionElement>(SimpleSelector.Type("caption")); } } [DOM("tHead")] public HTMLTableSectionElement THead { get { return _children.QuerySelector<HTMLTableSectionElement>(SimpleSelector.Type("thead")); } } [DOM("tBodies")] public HTMLCollection TBodies { get { return _children.QuerySelectorAll(SimpleSelector.Type("tbody")); } } [DOM("tFoot")] public HTMLTableSectionElement TFoot { get { return _children.QuerySelector<HTMLTableSectionElement>(SimpleSelector.Type("tfoot")); } } [DOM("rows")] public HTMLCollection Rows { get { return _children.QuerySelectorAll(SimpleSelector.Type("tr")); } } [DOM("align")] public HorizontalAlignment Align { get { return Element.ToEnum(GetAttribute("align"), HorizontalAlignment.Left); } set { SetAttribute("align", value.ToString()); } } [DOM("bgColor")] public string BgColor { get { return GetAttribute("bgcolor"); } set { SetAttribute("bgcolor", value); } } [DOM("border")] public uint Border { get { return Element.ToInteger(GetAttribute("border"), 0); } set { SetAttribute("border", value.ToString()); } } [DOM("cellPadding")] public int CellPadding { get { return Element.ToInteger(GetAttribute("cellpadding"), 0); } set { SetAttribute("cellpadding", value.ToString()); } } [DOM("cellSpacing")] public int CellSpacing { get { return Element.ToInteger(GetAttribute("cellspacing"), 0); } set { SetAttribute("cellspacing", value.ToString()); } } [DOM("frame")] public TableFrames Frame { get { return Element.ToEnum(GetAttribute("frame"), TableFrames.Void); } set { SetAttribute("frame", value.ToString()); } } [DOM("rules")] public TableRules Rules { get { return Element.ToEnum(GetAttribute("rules"), TableRules.All); } set { SetAttribute("rules", value.ToString()); } } [DOM("summary")] public string Summary { get { return GetAttribute("summary"); } set { SetAttribute("summary", value); } } [DOM("width")] public string Width { get { return GetAttribute("width"); } set { SetAttribute("width", value); } } protected internal override bool IsSpecial => true; internal HTMLTableElement() { _name = "table"; } [DOM("insertRow")] public HTMLTableRowElement InsertRow(int index) { HTMLCollection rows = Rows; HTMLTableRowElement hTMLTableRowElement = base.OwnerDocument.CreateElement("tr") as HTMLTableRowElement; if (index >= 0 && index < rows.Length) { Element element = rows[index]; element.ParentElement.InsertBefore(hTMLTableRowElement, element); } else if (rows.Length == 0) { HTMLCollection tBodies = TBodies; if (tBodies.Length == 0) { Element element2 = base.OwnerDocument.CreateElement("tbody"); AppendChild(element2); tBodies.Add(element2); } tBodies[tBodies.Length - 1].AppendChild(hTMLTableRowElement); } else { rows[rows.Length - 1].ParentElement.AppendChild(hTMLTableRowElement); } return hTMLTableRowElement; } [DOM("deleteRow")] public HTMLTableElement DeleteRow(int index) { HTMLCollection rows = Rows; if (index >= 0 && index < rows.Length) rows[index].Remove(); return this; } [DOM("createTHead")] public HTMLTableSectionElement CreateTHead() { HTMLTableSectionElement hTMLTableSectionElement = THead; if (hTMLTableSectionElement == null) { hTMLTableSectionElement = (base.OwnerDocument.CreateElement("thead") as HTMLTableSectionElement); AppendChild(hTMLTableSectionElement); } return hTMLTableSectionElement; } [DOM("deleteTHead")] public HTMLTableElement DeleteTHead() { THead?.Remove(); return this; } [DOM("createTFoot")] public HTMLTableSectionElement CreateTFoot() { HTMLTableSectionElement hTMLTableSectionElement = TFoot; if (hTMLTableSectionElement == null) { hTMLTableSectionElement = (base.OwnerDocument.CreateElement("tfoot") as HTMLTableSectionElement); AppendChild(hTMLTableSectionElement); } return hTMLTableSectionElement; } [DOM("deleteTFoot")] public HTMLTableElement DeleteTFoot() { TFoot?.Remove(); return this; } [DOM("createCaption")] public HTMLTableCaptionElement CreateCaption() { HTMLTableCaptionElement hTMLTableCaptionElement = Caption; if (hTMLTableCaptionElement == null) { hTMLTableCaptionElement = (base.OwnerDocument.CreateElement("caption") as HTMLTableCaptionElement); AppendChild(hTMLTableCaptionElement); } return hTMLTableCaptionElement; } [DOM("deleteCaption")] public HTMLTableElement DeleteCaption() { Caption?.Remove(); return this; } } }