ListObject
ListObject class
Represents a list object on a worksheet. The ListObject object is a member of the ListObjects collection. The ListObjects collection contains all the list objects on a worksheet.
class ListObject;
Example
const { Workbook, CellsHelper, TotalsCalculation } = require("aspose.cells.node");
var workbook = new Workbook();
var cells = workbook.getWorksheets().get(0).getCells();
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.getWorksheets().get(0).getListObjects();
var index = tables.add(0, 0, 9, 4, true);
var table = tables.get(0);
table.setShowTotals(true);
table.getListColumns().get(4).setTotalsCalculation(TotalsCalculation.Sum);
workbook.save("output/Book1.xlsx");
Methods
Method | Description |
---|---|
getStartRow() | Gets the start row of the range. |
getStartColumn() | Gets the start column of the range. |
getEndRow() | Gets the end row of the range. |
getEndColumn() | Gets the end column of the range. |
getListColumns() | Gets ListColumns of the ListObject. |
getShowHeaderRow() | Gets and sets whether this ListObject show header row. |
setShowHeaderRow(boolean) | Gets and sets whether this ListObject show header row. |
getShowTotals() | Gets and sets whether this ListObject show total row. |
setShowTotals(boolean) | Gets and sets whether this ListObject show total row. |
getDataRange() | Gets the data range of the ListObject. |
getQueryTable() | Gets the linked QueryTable. |
getDataSourceType() | Gets the data source type of the table. |
getAutoFilter() | Gets auto filter. |
getDisplayName() | Gets and sets the display name. |
setDisplayName(string) | Gets and sets the display name. |
getComment() | Gets and sets the comment of the table. |
setComment(string) | Gets and sets the comment of the table. |
getShowTableStyleFirstColumn() | Indicates whether the first column in the table should have the style applied. |
setShowTableStyleFirstColumn(boolean) | Indicates whether the first column in the table should have the style applied. |
getShowTableStyleLastColumn() | Indicates whether the last column in the table should have the style applied. |
setShowTableStyleLastColumn(boolean) | Indicates whether the last column in the table should have the style applied. |
getShowTableStyleRowStripes() | Indicates whether row stripe formatting is applied. |
setShowTableStyleRowStripes(boolean) | Indicates whether row stripe formatting is applied. |
getShowTableStyleColumnStripes() | Indicates whether column stripe formatting is applied. |
setShowTableStyleColumnStripes(boolean) | Indicates whether column stripe formatting is applied. |
getTableStyleType() | Gets and the built-in table style. |
setTableStyleType(TableStyleType) | Gets and the built-in table style. |
getTableStyleName() | Gets and sets the table style name. |
setTableStyleName(string) | Gets and sets the table style name. |
getXmlMap() | Gets an XmlMap used for this list. |
getAlternativeText() | Gets and sets the alternative text. |
setAlternativeText(string) | Gets and sets the alternative text. |
getAlternativeDescription() | Gets and sets the alternative description. |
setAlternativeDescription(string) | 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 from the worksheet. |
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. |
getStartRow()
Gets the start row of the range.
getStartRow() : number;
getStartColumn()
Gets the start column of the range.
getStartColumn() : number;
getEndRow()
Gets the end row of the range.
getEndRow() : number;
getEndColumn()
Gets the end column of the range.
getEndColumn() : number;
getListColumns()
Gets ListColumns of the ListObject.
getListColumns() : ListColumnCollection;
Returns
getShowHeaderRow()
Gets and sets whether this ListObject show header row.
getShowHeaderRow() : boolean;
setShowHeaderRow(boolean)
Gets and sets whether this ListObject show header row.
setShowHeaderRow(value: boolean) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | The value to set. |
getShowTotals()
Gets and sets whether this ListObject show total row.
getShowTotals() : boolean;
setShowTotals(boolean)
Gets and sets whether this ListObject show total row.
setShowTotals(value: boolean) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | The value to set. |
getDataRange()
Gets the data range of the ListObject.
getDataRange() : Range;
Returns
getQueryTable()
Gets the linked QueryTable.
getQueryTable() : QueryTable;
Returns
getDataSourceType()
Gets the data source type of the table.
getDataSourceType() : TableDataSourceType;
Returns
getAutoFilter()
Gets auto filter.
getAutoFilter() : AutoFilter;
Returns
getDisplayName()
Gets and sets the display name.
getDisplayName() : string;
setDisplayName(string)
Gets and sets the display name.
setDisplayName(value: string) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | string | The value to set. |
getComment()
Gets and sets the comment of the table.
getComment() : string;
setComment(string)
Gets and sets the comment of the table.
setComment(value: string) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | string | The value to set. |
getShowTableStyleFirstColumn()
Indicates whether the first column in the table should have the style applied.
getShowTableStyleFirstColumn() : boolean;
setShowTableStyleFirstColumn(boolean)
Indicates whether the first column in the table should have the style applied.
setShowTableStyleFirstColumn(value: boolean) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | The value to set. |
getShowTableStyleLastColumn()
Indicates whether the last column in the table should have the style applied.
getShowTableStyleLastColumn() : boolean;
setShowTableStyleLastColumn(boolean)
Indicates whether the last column in the table should have the style applied.
setShowTableStyleLastColumn(value: boolean) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | The value to set. |
getShowTableStyleRowStripes()
Indicates whether row stripe formatting is applied.
getShowTableStyleRowStripes() : boolean;
setShowTableStyleRowStripes(boolean)
Indicates whether row stripe formatting is applied.
setShowTableStyleRowStripes(value: boolean) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | The value to set. |
getShowTableStyleColumnStripes()
Indicates whether column stripe formatting is applied.
getShowTableStyleColumnStripes() : boolean;
setShowTableStyleColumnStripes(boolean)
Indicates whether column stripe formatting is applied.
setShowTableStyleColumnStripes(value: boolean) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | The value to set. |
getTableStyleType()
Gets and the built-in table style.
getTableStyleType() : TableStyleType;
Returns
setTableStyleType(TableStyleType)
Gets and the built-in table style.
setTableStyleType(value: TableStyleType) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | TableStyleType | The value to set. |
getTableStyleName()
Gets and sets the table style name.
getTableStyleName() : string;
setTableStyleName(string)
Gets and sets the table style name.
setTableStyleName(value: string) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | string | The value to set. |
getXmlMap()
Gets an XmlMap used for this list.
getXmlMap() : XmlMap;
Returns
getAlternativeText()
Gets and sets the alternative text.
getAlternativeText() : string;
setAlternativeText(string)
Gets and sets the alternative text.
setAlternativeText(value: string) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | string | The value to set. |
getAlternativeDescription()
Gets and sets the alternative description.
getAlternativeDescription() : string;
setAlternativeDescription(string)
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 from the worksheet.
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.
filter()
Filter the table.
filter() : AutoFilter;
Returns
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;