ListObject class

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.

The ListObject type exposes the following members:

Properties

PropertyDescription
start_rowGets the start row of the range.
start_columnGets the start column of the range.
end_rowGets the end row of the range.
end_columnGets the end column of the range.
list_columnsGets ListColumns of the ListObject.
show_header_rowGets and sets whether this ListObject show header row.
show_totalsGets and sets whether this ListObject show total row.
data_rangeGets the data range of the ListObject.
query_tableGets the linked QueryTable.
data_source_typeGets the data source type of the table.
auto_filterGets auto filter.
display_nameGets and sets the display name.
commentGets and sets the comment of the table.
show_table_style_first_columnIndicates whether the first column in the table should have the style applied.
show_table_style_last_columnIndicates whether the last column in the table should have the style applied.
show_table_style_row_stripesIndicates whether row stripe formatting is applied.
show_table_style_column_stripesIndicates whether column stripe formatting is applied.
table_style_typeGets and the built-in table style.
table_style_nameGets and sets the table style name.
xml_mapGets an ListObject.xml_map used for this list.
alternative_textGets and sets the alternative text.
alternative_descriptionGets and sets the alternative description.

Methods

MethodDescription
put_cell_valuePut the value to the cell.
put_cell_valuePut the value to the cell.
put_cell_formulaPut the formula to the cell in the table.
put_cell_formulaPut the formula to the cell in the table.
convert_to_rangeConvert the table to range.
convert_to_rangeConvert the table to range.
resizeResize the range of the list object.
update_column_nameUpdates all list columns’ name from the worksheet.
filterFilter the table.
apply_style_to_rangeApply the table style to the range.

Example

from aspose.cells import CellsHelper, Workbook
from aspose.cells.tables import TotalsCalculation

workbook = Workbook()
cells = workbook.worksheets[0].cells
for i in range(5):
    cells.get(0, i).put_value(CellsHelper.column_index_to_name(i))
for row in range(1, 10):
    for column in range(5):
        cells.get(row, column).put_value(row * column)
tables = workbook.worksheets[0].list_objects
index = tables.add(0, 0, 9, 4, True)
table = tables[0]
table.show_totals = True
table.list_columns[4].totals_calculation = TotalsCalculation.SUM
workbook.save(r"Book1.xlsx")

See Also