HtmlForgeX

API Reference

Class

Table

Namespace HtmlForgeX
Assembly HtmlForgeX
Base Element

Provides functionality for generating HTML tables and populating them from model data.

Inheritance

Constructors

Table 2 overloads
public Table(Nullable<TableType> library = null) #

Initializes a new empty table instance.

Parameters

library System.Nullable{HtmlForgeX.TableType} = null optionalposition: 0
Optional table style library.
public Table(IEnumerable<Object> objects, Nullable<TableType> library = null) #

Initializes a table from the provided objects.

Parameters

objects System.Collections.Generic.IEnumerable{System.Object} requiredposition: 0
Objects representing each row.
library System.Nullable{HtmlForgeX.TableType} = null optionalposition: 1
Optional table style library.

Methods

public Table AddFooter(String footer) #
Returns: Table

Adds a table footer cell.

Parameters

footer System.String requiredposition: 0
public Table AddFooters(params String[] footers) #
Returns: Table

Adds multiple footer cells.

Parameters

footers System.String[] requiredposition: 0
public Table AddHeader(String header) #
Returns: Table

Adds a table header cell.

Parameters

header System.String requiredposition: 0
Header text.

Returns

The current table.

public Table AddHeaders(params String[] headers) #
Returns: Table

Adds multiple header cells.

Parameters

headers System.String[] requiredposition: 0
public Table AddObjects(IEnumerable<Object> objects, Boolean addFooter = false) #
Returns: Table

Adds rows to the table using public properties of the supplied objects.

Parameters

objects System.Collections.Generic.IEnumerable{System.Object} requiredposition: 0
Collection of objects to read values from.
addFooter System.Boolean = false optionalposition: 1
When true, footer cells are generated from property names.

Returns

The current table instance.

AddRow 4 overloads
public Table AddRow(params Element[] cells) #
Returns: Table

Adds a row consisting of cell strings.

Parameters

row System.Collections.Generic.List{System.String} requiredposition: 0
AddRow(HtmlForgeX.TableCell[] cells) #

Adds a row consisting of typed table cells.

Parameters

cells HtmlForgeX.TableCell[] required
AddRow(System.Collections.Generic.IEnumerable{HtmlForgeX.TableCell} cells) #

Adds a row consisting of typed table cells.

Parameters

cells System.Collections.Generic.IEnumerable{HtmlForgeX.TableCell} required
AddRow(HtmlForgeX.Element[] cells) #

Adds a row consisting of HtmlForgeX elements (each element becomes a cell).

Parameters

cells HtmlForgeX.Element[] required
public Table AddRows(params List<String>[] rows) #
Returns: Table

Adds multiple table rows.

Parameters

rows System.Collections.Generic.List{System.String}[] requiredposition: 0
public virtual String BuildTable() #
Returns: String

Builds the table markup using the configured headers, rows and footers.

Returns

HTML markup for the table.

Create 2 overloads
public static Table Create(Object obj, TableType tableType) #
Returns: Table

Creates a table instance using the specified objects and table type.

Parameters

objects System.Collections.Generic.IEnumerable{System.Object} requiredposition: 0
Source objects to populate the table.
tableType HtmlForgeX.TableType requiredposition: 1
Desired table style.

Returns

Concrete Table implementation.

Create(System.Object obj, HtmlForgeX.TableType tableType) #

Creates a table from a single object or collection.

Parameters

obj System.Object required
Object or collection to convert.
tableType HtmlForgeX.TableType required
Desired table style.

Returns

Concrete Table implementation.

RegisterLibraries() #

Registers the required libraries for Table based on its TableType.

public override String ToString() #
Returns: String

Returns the generated HTML table markup.

Returns

HTML markup for the table.

Properties

public Func<TableValueFormatContext, String> ValueFormatter { get; set; } #

Optional formatter for converting raw cell values into strings. When set, all value-to-string conversions in this table go through this delegate.

public Boolean EncodeCellValues { get; set; } #

When enabled, plain object values are HTML-encoded before they are written into table cells. Values rendered through ValueFormatter are treated as formatter-owned output.

public HashSet<String> IncludeProperties { get; set; } #

Optional include filter for object/dictionary/PS-like properties by name. If set and non-empty, only listed properties will be included. Comparison is case-insensitive.

public HashSet<String> ExcludeProperties { get; set; } #

Optional exclude filter for object/dictionary/PS-like properties by name. Applied after IncludeProperties filtering. Comparison is case-insensitive.

public List<String> TableHeaders { get; set; } #

Collection of table headers.

public List<String> TableFooters { get; set; } #

Collection of table footers.

public List<List<String>> TableRows { get; set; } #

Collection of table rows.