HtmlTable
Overview
HtmlTable is a class in Aspose.Cells FOSS for Typescript.
HtmlTable.parse(html, cssClasses) parses a single HTML table string into an HtmlTable object, applying optional CSS class filters.
This class provides 10 methods for working with HtmlTable objects in Typescript programs.
Available methods include: addHeader, addRow, constructor, getCellStyle, mergeTables, parse, parseAll, setCssClasses, toHtml, toWorksheet.
All public members are accessible to any Typescript application after installing the Aspose.Cells FOSS for Typescript package.
Properties: caption, colWidths, color, cols, count, headers, and 6 more.
Description
HtmlTable is a class in the Aspose.Cells FOSS library for TypeScript that exposes 9 methods and 14 properties for programmatic use.
Core capabilities include: : number; : number; : number. These operations enable developers to integrate htmltable functionality directly into TypeScript applications.
The class also provides the cols property (gets the cols), the count property (gets the count), the height property (gets the height).
Instances are created through a single constructor that initializes the object with default values.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
cols | : number | Read | Gets the cols. |
count | : number | Read | Gets the count. |
height | : number | Read | Gets the height. |
caption | string | undefined | Read | Gets the caption. |
headers | string[] | Read | Gets the headers. |
rows | string[][] | Read | Gets the rows. |
colWidths | number[] | Read | Gets the col widths. |
rowHeights | number[] | Read | Gets the row heights. |
hiddenRows | boolean[] | Read | Gets the hidden rows. |
pictures | PictureInfo[] | Read | Gets the pictures. |
style | : string | Read | Gets the style. |
color | : string | Read | Gets the color. |
Methods
| Signature | Description |
|---|---|
constructor(caption: string) | Creates a new HtmlTable with the specified caption text. |
setCssClasses(classes: Map<string, CellStyle>) | Sets the css classes value. |
getCellStyle(row: number, col: number) → CellStyle | undefined | Returns a CellStyle object for the specified cell or undefined if no style is defined |
addHeader(header: string) | Adds a column header string to the table. |
addRow(row: string[]) | Appends an array of cell values as a new row to the table. |
parseAll(html: string, cssClasses: Map<string, CellStyle>) → HtmlTable[] | Parses all HTML tables in an HTML string and returns them as an array of HtmlTable objects. |
toWorksheet(worksheet: Worksheet, options: HtmlParseOptions) | Writes this HtmlTable’s data into the specified Worksheet using the given parse options. |
parse(html: string, cssClasses: Map<string, CellStyle>) → HtmlTable | Parses a single HTML table into an HtmlTable object, which can then be written to a worksheet via toWorksheet |
mergeTables(tables: HtmlTable[]) → HtmlTable | Combines multiple HtmlTable instances into a single table, preserving rows and columns |
toHtml(options: HtmlSaveOptions) → string | Serializes the HtmlTable to an HTML string using the specified save options. |