ListObject
ListObject class
Represents a table in a worksheet.
class ListObject;
Example
const { Workbook, CellsHelper, TotalsCalculation } = require("aspose.cells.node");
var workbook = new Workbook();
var cells = workbook.worksheets.get(0).cells;
for (var i = 0; i < 5; i++) {
cells.get(0, i).putValue(CellsHelper.columnIndexToName(i));
}
for (var row = 1; row < 10; row++) {
for (var column = 0; column < 5; column++) {
cells.get(row, column).putValue(row * column);
}
}
var tables = workbook.worksheets.get(0).getListObjects();
var index = tables.add(0, 0, 9, 4, true);
var table = tables.get(0);
table.showTotals = true;
table.listColumns.get(4).totalsCalculation = TotalsCalculation.Sum;
workbook.save("output/Book1.xlsx");
Properties
| Property | Type | Description |
|---|---|---|
| startRow | number | Readonly. Gets the start row of the range. |
| startColumn | number | Readonly. Gets the start column of the range. |
| endRow | number | Readonly. Gets the end row of the range. |
| endColumn | number | Readonly. Gets the end column of the range. |
| listColumns | ListColumnCollection | Readonly. Gets the ListColumn list of this table. |
| showHeaderRow | boolean | Gets and sets whether this Table shows header row. |
| showTotals | boolean | Gets and sets whether this TAble shows total row. |
| dataRange | Range | Readonly. Gets the data range of the Table. |
| queryTable | QueryTable | Readonly. Gets the linked QueryTable. |
| dataSourceType | TableDataSourceType | Readonly. Gets the data source type of the table. |
| hasAutoFilter | boolean | Indicates whether auto filter is applied to this table. |
| autoFilter | AutoFilter | Readonly. Gets auto filter of this table. |
| displayName | string | Gets and sets the display name of the table. |
| comment | string | Gets and sets the comment of the table. |
| showTableStyleFirstColumn | boolean | Indicates whether the first column in the table is the style applied to. |
| showTableStyleLastColumn | boolean | Indicates whether the last column in the table is the style applied to. |
| showTableStyleRowStripes | boolean | Indicates whether row stripe formatting is applied to. |
| showTableStyleColumnStripes | boolean | Indicates whether column stripe formatting is applied to. |
| tableStyleType | TableStyleType | Gets and the built-in table style. |
| tableStyleName | string | Gets and sets the table style name. |
| xmlMap | XmlMap | Readonly. Gets an XmlMap used for this list. |
| alternativeText | string | Gets and sets the alternative text. |
| alternativeDescription | string | Gets and sets the alternative description. |
Methods
| Method | Description |
|---|---|
| getStartRow() | @deprecated. Please use the ‘startRow’ property instead. Gets the start row of the range. |
| getStartColumn() | @deprecated. Please use the ‘startColumn’ property instead. Gets the start column of the range. |
| getEndRow() | @deprecated. Please use the ’endRow’ property instead. Gets the end row of the range. |
| getEndColumn() | @deprecated. Please use the ’endColumn’ property instead. Gets the end column of the range. |
| getListColumns() | @deprecated. Please use the ’listColumns’ property instead. Gets the ListColumn list of this table. |
| getShowHeaderRow() | @deprecated. Please use the ‘showHeaderRow’ property instead. Gets and sets whether this Table shows header row. |
| setShowHeaderRow(boolean) | @deprecated. Please use the ‘showHeaderRow’ property instead. Gets and sets whether this Table shows header row. |
| getShowTotals() | @deprecated. Please use the ‘showTotals’ property instead. Gets and sets whether this TAble shows total row. |
| setShowTotals(boolean) | @deprecated. Please use the ‘showTotals’ property instead. Gets and sets whether this TAble shows total row. |
| getDataRange() | @deprecated. Please use the ‘dataRange’ property instead. Gets the data range of the Table. |
| getQueryTable() | @deprecated. Please use the ‘queryTable’ property instead. Gets the linked QueryTable. |
| getDataSourceType() | @deprecated. Please use the ‘dataSourceType’ property instead. Gets the data source type of the table. |
| getHasAutoFilter() | @deprecated. Please use the ‘hasAutoFilter’ property instead. Indicates whether auto filter is applied to this table. |
| setHasAutoFilter(boolean) | @deprecated. Please use the ‘hasAutoFilter’ property instead. Indicates whether auto filter is applied to this table. |
| getAutoFilter() | @deprecated. Please use the ‘autoFilter’ property instead. Gets auto filter of this table. |
| getDisplayName() | @deprecated. Please use the ‘displayName’ property instead. Gets and sets the display name of the table. |
| setDisplayName(string) | @deprecated. Please use the ‘displayName’ property instead. Gets and sets the display name of the table. |
| getComment() | @deprecated. Please use the ‘comment’ property instead. Gets and sets the comment of the table. |
| setComment(string) | @deprecated. Please use the ‘comment’ property instead. Gets and sets the comment of the table. |
| getShowTableStyleFirstColumn() | @deprecated. Please use the ‘showTableStyleFirstColumn’ property instead. Indicates whether the first column in the table is the style applied to. |
| setShowTableStyleFirstColumn(boolean) | @deprecated. Please use the ‘showTableStyleFirstColumn’ property instead. Indicates whether the first column in the table is the style applied to. |
| getShowTableStyleLastColumn() | @deprecated. Please use the ‘showTableStyleLastColumn’ property instead. Indicates whether the last column in the table is the style applied to. |
| setShowTableStyleLastColumn(boolean) | @deprecated. Please use the ‘showTableStyleLastColumn’ property instead. Indicates whether the last column in the table is the style applied to. |
| getShowTableStyleRowStripes() | @deprecated. Please use the ‘showTableStyleRowStripes’ property instead. Indicates whether row stripe formatting is applied to. |
| setShowTableStyleRowStripes(boolean) | @deprecated. Please use the ‘showTableStyleRowStripes’ property instead. Indicates whether row stripe formatting is applied to. |
| getShowTableStyleColumnStripes() | @deprecated. Please use the ‘showTableStyleColumnStripes’ property instead. Indicates whether column stripe formatting is applied to. |
| setShowTableStyleColumnStripes(boolean) | @deprecated. Please use the ‘showTableStyleColumnStripes’ property instead. Indicates whether column stripe formatting is applied to. |
| getTableStyleType() | @deprecated. Please use the ’tableStyleType’ property instead. Gets and the built-in table style. |
| setTableStyleType(TableStyleType) | @deprecated. Please use the ’tableStyleType’ property instead. Gets and the built-in table style. |
| getTableStyleName() | @deprecated. Please use the ’tableStyleName’ property instead. Gets and sets the table style name. |
| setTableStyleName(string) | @deprecated. Please use the ’tableStyleName’ property instead. Gets and sets the table style name. |
| getXmlMap() | @deprecated. Please use the ‘xmlMap’ property instead. Gets an XmlMap used for this list. |
| getAlternativeText() | @deprecated. Please use the ‘alternativeText’ property instead. Gets and sets the alternative text. |
| setAlternativeText(string) | @deprecated. Please use the ‘alternativeText’ property instead. Gets and sets the alternative text. |
| getAlternativeDescription() | @deprecated. Please use the ‘alternativeDescription’ property instead. Gets and sets the alternative description. |
| setAlternativeDescription(string) | @deprecated. Please use the ‘alternativeDescription’ property instead. Gets and sets the alternative description. |
| resize(number, number, number, number, boolean) | Resize the range of the list object. |
| putCellValue(number, number, Object) | Put the value to the cell. |
| putCellValue(number, number, Object, boolean) | Put the value to the cell. |
| putCellFormula(number, number, string) | Put the formula to the cell in the table. |
| putCellFormula(number, number, string, boolean) | Put the formula to the cell in the table. |
| updateColumnName() | Updates all list columns’ name to cells in the table. |
| removeAutoFilter() | Removes auto filter which is applied to this table. |
| filter() | Filter the table. |
| applyStyleToRange() | Apply the table style to the range. |
| convertToRange() | Convert the table to range. |
| convertToRange(TableToRangeOptions) | Convert the table to range. |
| isNull() | Checks whether the implementation object is null. |
startRow
Readonly. Gets the start row of the range.
startRow : number;
startColumn
Readonly. Gets the start column of the range.
startColumn : number;
endRow
Readonly. Gets the end row of the range.
endRow : number;
endColumn
Readonly. Gets the end column of the range.
endColumn : number;
listColumns
Readonly. Gets the ListColumn list of this table.
listColumns : ListColumnCollection;
showHeaderRow
Gets and sets whether this Table shows header row.
showHeaderRow : boolean;
showTotals
Gets and sets whether this TAble shows total row.
showTotals : boolean;
dataRange
Readonly. Gets the data range of the Table.
dataRange : Range;
queryTable
Readonly. Gets the linked QueryTable.
queryTable : QueryTable;
dataSourceType
Readonly. Gets the data source type of the table.
dataSourceType : TableDataSourceType;
hasAutoFilter
Indicates whether auto filter is applied to this table.
hasAutoFilter : boolean;
autoFilter
Readonly. Gets auto filter of this table.
autoFilter : AutoFilter;
Remarks
It works only when HasAutoFilter is false.
displayName
Gets and sets the display name of the table.
displayName : string;
comment
Gets and sets the comment of the table.
comment : string;
showTableStyleFirstColumn
Indicates whether the first column in the table is the style applied to.
showTableStyleFirstColumn : boolean;
showTableStyleLastColumn
Indicates whether the last column in the table is the style applied to.
showTableStyleLastColumn : boolean;
showTableStyleRowStripes
Indicates whether row stripe formatting is applied to.
showTableStyleRowStripes : boolean;
showTableStyleColumnStripes
Indicates whether column stripe formatting is applied to.
showTableStyleColumnStripes : boolean;
tableStyleType
Gets and the built-in table style.
tableStyleType : TableStyleType;
tableStyleName
Gets and sets the table style name.
tableStyleName : string;
xmlMap
Readonly. Gets an XmlMap used for this list.
xmlMap : XmlMap;
alternativeText
Gets and sets the alternative text.
alternativeText : string;
alternativeDescription
Gets and sets the alternative description.
alternativeDescription : string;
getStartRow()
@deprecated. Please use the ‘startRow’ property instead. Gets the start row of the range.
getStartRow() : number;
getStartColumn()
@deprecated. Please use the ‘startColumn’ property instead. Gets the start column of the range.
getStartColumn() : number;
getEndRow()
@deprecated. Please use the ’endRow’ property instead. Gets the end row of the range.
getEndRow() : number;
getEndColumn()
@deprecated. Please use the ’endColumn’ property instead. Gets the end column of the range.
getEndColumn() : number;
getListColumns()
@deprecated. Please use the ’listColumns’ property instead. Gets the ListColumn list of this table.
getListColumns() : ListColumnCollection;
Returns
getShowHeaderRow()
@deprecated. Please use the ‘showHeaderRow’ property instead. Gets and sets whether this Table shows header row.
getShowHeaderRow() : boolean;
setShowHeaderRow(boolean)
@deprecated. Please use the ‘showHeaderRow’ property instead. Gets and sets whether this Table shows header row.
setShowHeaderRow(value: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean | The value to set. |
getShowTotals()
@deprecated. Please use the ‘showTotals’ property instead. Gets and sets whether this TAble shows total row.
getShowTotals() : boolean;
setShowTotals(boolean)
@deprecated. Please use the ‘showTotals’ property instead. Gets and sets whether this TAble shows total row.
setShowTotals(value: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean | The value to set. |
getDataRange()
@deprecated. Please use the ‘dataRange’ property instead. Gets the data range of the Table.
getDataRange() : Range;
Returns
getQueryTable()
@deprecated. Please use the ‘queryTable’ property instead. Gets the linked QueryTable.
getQueryTable() : QueryTable;
Returns
getDataSourceType()
@deprecated. Please use the ‘dataSourceType’ property instead. Gets the data source type of the table.
getDataSourceType() : TableDataSourceType;
Returns
getHasAutoFilter()
@deprecated. Please use the ‘hasAutoFilter’ property instead. Indicates whether auto filter is applied to this table.
getHasAutoFilter() : boolean;
setHasAutoFilter(boolean)
@deprecated. Please use the ‘hasAutoFilter’ property instead. Indicates whether auto filter is applied to this table.
setHasAutoFilter(value: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean | The value to set. |
getAutoFilter()
@deprecated. Please use the ‘autoFilter’ property instead. Gets auto filter of this table.
getAutoFilter() : AutoFilter;
Returns
Remarks
It works only when HasAutoFilter is false.
getDisplayName()
@deprecated. Please use the ‘displayName’ property instead. Gets and sets the display name of the table.
getDisplayName() : string;
setDisplayName(string)
@deprecated. Please use the ‘displayName’ property instead. Gets and sets the display name of the table.
setDisplayName(value: string) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | string | The value to set. |
getComment()
@deprecated. Please use the ‘comment’ property instead. Gets and sets the comment of the table.
getComment() : string;
setComment(string)
@deprecated. Please use the ‘comment’ property instead. Gets and sets the comment of the table.
setComment(value: string) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | string | The value to set. |
getShowTableStyleFirstColumn()
@deprecated. Please use the ‘showTableStyleFirstColumn’ property instead. Indicates whether the first column in the table is the style applied to.
getShowTableStyleFirstColumn() : boolean;
setShowTableStyleFirstColumn(boolean)
@deprecated. Please use the ‘showTableStyleFirstColumn’ property instead. Indicates whether the first column in the table is the style applied to.
setShowTableStyleFirstColumn(value: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean | The value to set. |
getShowTableStyleLastColumn()
@deprecated. Please use the ‘showTableStyleLastColumn’ property instead. Indicates whether the last column in the table is the style applied to.
getShowTableStyleLastColumn() : boolean;
setShowTableStyleLastColumn(boolean)
@deprecated. Please use the ‘showTableStyleLastColumn’ property instead. Indicates whether the last column in the table is the style applied to.
setShowTableStyleLastColumn(value: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean | The value to set. |
getShowTableStyleRowStripes()
@deprecated. Please use the ‘showTableStyleRowStripes’ property instead. Indicates whether row stripe formatting is applied to.
getShowTableStyleRowStripes() : boolean;
setShowTableStyleRowStripes(boolean)
@deprecated. Please use the ‘showTableStyleRowStripes’ property instead. Indicates whether row stripe formatting is applied to.
setShowTableStyleRowStripes(value: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean | The value to set. |
getShowTableStyleColumnStripes()
@deprecated. Please use the ‘showTableStyleColumnStripes’ property instead. Indicates whether column stripe formatting is applied to.
getShowTableStyleColumnStripes() : boolean;
setShowTableStyleColumnStripes(boolean)
@deprecated. Please use the ‘showTableStyleColumnStripes’ property instead. Indicates whether column stripe formatting is applied to.
setShowTableStyleColumnStripes(value: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean | The value to set. |
getTableStyleType()
@deprecated. Please use the ’tableStyleType’ property instead. Gets and the built-in table style.
getTableStyleType() : TableStyleType;
Returns
setTableStyleType(TableStyleType)
@deprecated. Please use the ’tableStyleType’ property instead. Gets and the built-in table style.
setTableStyleType(value: TableStyleType) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | TableStyleType | The value to set. |
getTableStyleName()
@deprecated. Please use the ’tableStyleName’ property instead. Gets and sets the table style name.
getTableStyleName() : string;
setTableStyleName(string)
@deprecated. Please use the ’tableStyleName’ property instead. Gets and sets the table style name.
setTableStyleName(value: string) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | string | The value to set. |
getXmlMap()
@deprecated. Please use the ‘xmlMap’ property instead. Gets an XmlMap used for this list.
getXmlMap() : XmlMap;
Returns
getAlternativeText()
@deprecated. Please use the ‘alternativeText’ property instead. Gets and sets the alternative text.
getAlternativeText() : string;
setAlternativeText(string)
@deprecated. Please use the ‘alternativeText’ property instead. Gets and sets the alternative text.
setAlternativeText(value: string) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | string | The value to set. |
getAlternativeDescription()
@deprecated. Please use the ‘alternativeDescription’ property instead. Gets and sets the alternative description.
getAlternativeDescription() : string;
setAlternativeDescription(string)
@deprecated. Please use the ‘alternativeDescription’ property instead. Gets and sets the alternative description.
setAlternativeDescription(value: string) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | string | The value to set. |
resize(number, number, number, number, boolean)
Resize the range of the list object.
resize(startRow: number, startColumn: number, endRow: number, endColumn: number, hasHeaders: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| startRow | number | The start row index of the new range. |
| startColumn | number | The start column index of the new range. |
| endRow | number | The end row index of the new range. |
| endColumn | number | The end column index of the new range. |
| hasHeaders | boolean | Whether this table has headers. |
putCellValue(number, number, Object)
Put the value to the cell.
putCellValue(rowOffset: number, columnOffset: number, value: Object) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rowOffset | number | The row offset in the table. |
| columnOffset | number | The column offset in the table. |
| value | Object | The cell value. |
putCellValue(number, number, Object, boolean)
Put the value to the cell.
putCellValue(rowOffset: number, columnOffset: number, value: Object, isTotalsRowLabel: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rowOffset | number | The row offset in the table. |
| columnOffset | number | The column offset in the table. |
| value | Object | The cell value. |
| isTotalsRowLabel | boolean | Indicates whether it is a label for total row,only works for total row. /// If False and this row is total row, a new row will be inserted. |
putCellFormula(number, number, string)
Put the formula to the cell in the table.
putCellFormula(rowOffset: number, columnOffset: number, formula: string) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rowOffset | number | The row offset in the table. |
| columnOffset | number | The column offset in the table. |
| formula | string | The formula of the cell. |
putCellFormula(number, number, string, boolean)
Put the formula to the cell in the table.
putCellFormula(rowOffset: number, columnOffset: number, formula: string, isTotalsRowFormula: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rowOffset | number | The row offset in the table. |
| columnOffset | number | The column offset in the table. |
| formula | string | The formula of the cell. |
| isTotalsRowFormula | boolean |
updateColumnName()
Updates all list columns’ name to cells in the table.
updateColumnName() : void;
Remarks
The value of the cells in the header row of the table must be same as the name of the ListColumn; Cell.PutValue do not auto modify the name of the ListColumn for performance.
removeAutoFilter()
Removes auto filter which is applied to this table.
removeAutoFilter() : void;
filter()
Filter the table.
filter() : AutoFilter;
Returns
Remarks
NOTE: This member is now obsolete. Instead,please set ListObject.HasAutoFilter property. This property will be removed 12 months later since October 2025. Aspose apologizes for any inconvenience you may have experienced.
applyStyleToRange()
Apply the table style to the range.
applyStyleToRange() : void;
convertToRange()
Convert the table to range.
convertToRange() : void;
convertToRange(TableToRangeOptions)
Convert the table to range.
convertToRange(options: TableToRangeOptions) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| options | TableToRangeOptions | the options when converting table to range. |
isNull()
Checks whether the implementation object is null.
isNull() : boolean;