Class HTMLTableElement

Class HTMLTableElement

Namespace: Aspose.Html
Assembly: Aspose.HTML.dll (25.2.0)

The create* and delete* methods on the table allow authors to construct and modify tables. [HTML 4.01] specifies that only one of each of the CAPTION, THEAD, and TFOOT elements may exist in a table. Therefore, if one exists, and the createTHead() or createTFoot() method is called, the method returns the existing THead or TFoot element. See the TABLE element definition in HTML 4.01.

See also the Document object Model (DOM) Level 2 HTML Specification.

[DOMName("HTMLTableElement")]
[DOMObject]
[ComVisible(true)]
public class HTMLTableElement : HTMLElement, INotifyPropertyChanged, IEventTarget, IDisposable, IXPathNSResolver, IParentNode, IElementTraversal, IChildNode, IElementCSSInlineStyle, IGlobalEventHandlers

Inheritance

objectDOMObjectEventTargetNodeElementHTMLElementHTMLTableElement

Implements

INotifyPropertyChanged, IEventTarget, IDisposable, IXPathNSResolver, IParentNode, IElementTraversal, IChildNode, IElementCSSInlineStyle, IGlobalEventHandlers

Inherited Members

HTMLElement.Id, HTMLElement.Title, HTMLElement.Lang, HTMLElement.Dir, HTMLElement.ClassName, HTMLElement.Style, HTMLElement.OnAbort, HTMLElement.OnBlur, HTMLElement.OnCancel, HTMLElement.OnCanplay, HTMLElement.OnCanPlayThrough, HTMLElement.OnChange, HTMLElement.OnClick, HTMLElement.OnCueChange, HTMLElement.OnDblClick, HTMLElement.OnDurationChange, HTMLElement.OnEmptied, HTMLElement.OnEnded, HTMLElement.OnError, HTMLElement.OnFocus, HTMLElement.OnInput, HTMLElement.OnInvalid, HTMLElement.OnKeyDown, HTMLElement.OnKeyPress, HTMLElement.OnKeyUp, HTMLElement.OnLoad, HTMLElement.OnLoadedData, HTMLElement.OnLoadedMetadata, HTMLElement.OnLoadStart, HTMLElement.OnMouseDown, HTMLElement.OnMouseEnter, HTMLElement.OnMouseLeave, HTMLElement.OnMouseMove, HTMLElement.OnMouseOut, HTMLElement.OnMouseOver, HTMLElement.OnMouseUp, HTMLElement.OnMouseWheel, HTMLElement.OnPause, HTMLElement.OnPlay, HTMLElement.OnPlaying, HTMLElement.OnProgress, HTMLElement.OnRateChange, HTMLElement.OnReset, HTMLElement.OnResize, HTMLElement.OnScroll, HTMLElement.OnSeeked, HTMLElement.OnSeeking, HTMLElement.OnSelect, HTMLElement.OnShow, HTMLElement.OnStalled, HTMLElement.OnSubmit, HTMLElement.OnSuspend, HTMLElement.OnTimeUpdate, HTMLElement.OnToggle, HTMLElement.OnVolumeChange, HTMLElement.OnWaiting, Element.GetAttributeNames(), Element.HasAttributes(), Element.GetAttribute(string), Element.GetAttributeNS(string, string), Element.SetAttribute(string, string), Element.SetAttributeNS(string, string, string), Element.RemoveAttribute(string), Element.RemoveAttributeNS(string, string), Element.HasAttribute(string), Element.HasAttributeNS(string, string), Element.ToggleAttribute(string), Element.ToggleAttribute(string, bool), Element.GetAttributeNode(string), Element.SetAttributeNode(Attr), Element.RemoveAttributeNode(Attr), Element.GetAttributeNodeNS(string, string), Element.SetAttributeNodeNS(Attr), Element.GetElementsByTagName(string), Element.GetElementsByTagNameNS(string, string), Element.Remove(), Element.QuerySelectorAll(string), Element.QuerySelector(string), Element.AttachShadow(ShadowRootMode), Element.GetElementsByClassName(string), Element.Dispose(bool), Element.ClassList, Element.LocalName, Element.NamespaceURI, Element.Prefix, Element.NodeName, Element.NodeType, Element.TagName, Element.Id, Element.ClassName, Element.TextContent, Element.Attributes, Element.FirstElementChild, Element.LastElementChild, Element.PreviousElementSibling, Element.NextElementSibling, Element.ChildElementCount, Element.Children, Element.InnerHTML, Element.OuterHTML, Element.ShadowRoot, Node.ELEMENT_NODE, Node.ATTRIBUTE_NODE, Node.TEXT_NODE, Node.CDATA_SECTION_NODE, Node.ENTITY_REFERENCE_NODE, Node.ENTITY_NODE, Node.PROCESSING_INSTRUCTION_NODE, Node.COMMENT_NODE, Node.DOCUMENT_NODE, Node.DOCUMENT_TYPE_NODE, Node.DOCUMENT_FRAGMENT_NODE, Node.NOTATION_NODE, Node.HasChildNodes(), Node.Normalize(), Node.CloneNode(), Node.CloneNode(bool), Node.IsEqualNode(Node), Node.IsSameNode(Node), Node.LookupPrefix(string), Node.LookupNamespaceURI(string), Node.IsDefaultNamespace(string), Node.InsertBefore(Node, Node), Node.ReplaceChild(Node, Node), Node.RemoveChild(Node), Node.AppendChild(Node), Node.Dispose(bool), Node.ToString(), Node.NodeType, Node.LocalName, Node.NamespaceURI, Node.Prefix, Node.NodeName, Node.BaseURI, Node.OwnerDocument, Node.ParentNode, Node.ParentElement, Node.ChildNodes, Node.FirstChild, Node.LastChild, Node.PreviousSibling, Node.NextSibling, Node.NodeValue, Node.TextContent, EventTarget.AddEventListener(string, DOMEventHandler, bool), EventTarget.AddEventListener(string, IEventListener), EventTarget.AddEventListener(string, IEventListener, bool), EventTarget.RemoveEventListener(string, DOMEventHandler, bool), EventTarget.RemoveEventListener(string, IEventListener), EventTarget.RemoveEventListener(string, IEventListener, bool), EventTarget.DispatchEvent(Event), EventTarget.Dispose(), EventTarget.Dispose(bool), DOMObject.GetPlatformType(), object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Properties

Align

Specifies the table’s position with respect to the rest of the document. See the align attribute definition in HTML 4.01. This attribute is deprecated in HTML 4.01.

[DOMName("align")]
public string Align { get; set; }

Property Value

string

BgColor

Cell background color. See the bgcolor attribute definition in HTML 4.01. This attribute is deprecated in HTML 4.01.

[DOMName("bgColor")]
public string BgColor { get; set; }

Property Value

string

Border

The width of the border around the table. See the border attribute definition in HTML 4.01.

[DOMName("border")]
public string Border { get; set; }

Property Value

string

Caption

Returns the table’s CAPTION, or void if none exists. @version DOM Level 2

[DOMName("caption")]
public HTMLTableCaptionElement Caption { get; }

Property Value

HTMLTableCaptionElement

CellPadding

Specifies the horizontal and vertical space between cell content and cell borders. See the cellpadding attribute definition in HTML 4.01.

[DOMName("cellPadding")]
public string CellPadding { get; set; }

Property Value

string

CellSpacing

Specifies the horizontal and vertical separation between cells. See the cellspacing attribute definition in HTML 4.01.

[DOMName("cellSpacing")]
public string CellSpacing { get; set; }

Property Value

string

Frame

Specifies which external table borders to render. See the frame attribute definition in HTML 4.01.

[DOMName("frame")]
public string Frame { get; set; }

Property Value

string

Rows

Returns the table’s TFOOT, or null if none exists.

[DOMName("rows")]
public HTMLCollection Rows { get; }

Property Value

HTMLCollection

Exceptions

DOMException

HIERARCHY_REQUEST_ERR: if the element is not a TFOOT. @version DOM Level 2

Rules

Specifies which internal table borders to render. See the rules attribute definition in HTML 4.01.

[DOMName("rules")]
public string Rules { get; set; }

Property Value

string

Summary

Description about the purpose or structure of a table. See the summary attribute definition in HTML 4.01.

[DOMName("summary")]
public string Summary { get; set; }

Property Value

string

TBodies

Returns a collection of the table bodies (including implicit ones).

[DOMName("tBodies")]
public HTMLCollection TBodies { get; }

Property Value

HTMLCollection

TFoot

Returns the table’s THEAD, or null if none exists.

[DOMName("tFoot")]
[DOMNullable]
public HTMLTableSectionElement TFoot { get; }

Property Value

HTMLTableSectionElement

Exceptions

DOMException

HIERARCHY_REQUEST_ERR: if the element is not a THEAD. @version DOM Level 2

THead

Returns the table’s CAPTION, or void if none exists.

[DOMName("tHead")]
[DOMNullable]
public HTMLTableSectionElement THead { get; }

Property Value

HTMLTableSectionElement

Exceptions

DOMException

HIERARCHY_REQUEST_ERR: if the element is not a CAPTION. @version DOM Level 2

Width

Specifies the desired table width. See the width attribute definition in HTML 4.01.

[DOMName("width")]
public string Width { get; set; }

Property Value

string

Methods

CreateCaption()

Create a new table caption object or return an existing one.

[DOMName("createCaption")]
public Element CreateCaption()

Returns

Element

A CAPTION element.

CreateTFoot()

Create a table footer row or return an existing one.

[DOMName("createTFoot")]
public Element CreateTFoot()

Returns

Element

A footer element (TFOOT).

CreateTHead()

Create a table header row or return an existing one.

[DOMName("createTHead")]
public Element CreateTHead()

Returns

Element

A new table header element (THEAD).

DeleteCaption()

Delete the table caption, if one exists.

[DOMName("deleteCaption")]
public void DeleteCaption()

DeleteRow(int)

Delete a table row.

[DOMName("deleteRow")]
public void DeleteRow(int index)

Parameters

index int

The index of the row to be deleted. This index starts from 0 and is relative to the logical order (not document order) of all the rows contained inside the table. If the index is -1 the last row in the table is deleted.

Exceptions

DOMException

INDEX_SIZE_ERR: Raised if the specified index is greater than or equal to the number of rows or if the index is a negative number other than -1. @version DOM Level 2

DeleteTFoot()

Delete the footer from the table, if one exists.

[DOMName("deleteTFoot")]
public void DeleteTFoot()

DeleteTHead()

Delete the header from the table, if one exists.

[DOMName("deleteTHead")]
public void DeleteTHead()

InsertRow(int)

Insert a new empty row in the table. The new row is inserted immediately before and in the same section as the current indexth row in the table. If index is -1 or equal to the number of rows, the new row is appended. In addition, when the table is empty the row is inserted into a TBODY which is created and inserted into the table.A table row cannot be empty according to [HTML 4.01].

[DOMName("insertRow")]
public Node InsertRow(int index)

Parameters

index int

The row number where to insert a new row. This index starts from 0 and is relative to the logical order (not document order) of all the rows contained inside the table.

Returns

Node

The newly created row.

Exceptions

DOMException

INDEX_SIZE_ERR: Raised if the specified index is greater than the number of rows or if the index is a negative number other than -1. @version DOM Level 2