ListColumn类
ListColumn类
代表表中的一列。
ListColumn 类型公开以下成员:
属性
属性 | 描述 |
---|---|
name | 获取并设置列的名称。 |
totals_calculation | 获取并设置列表列总计行中的计算类型。 |
range | 获取此列表列的范围。 |
is_array_formula | 指示公式是否为数组公式。 |
formula | 获取和设置列表列的公式。 |
totals_row_label | 获取和设置总计行的显示标签。 |
方法
方法 | 描述 |
---|---|
get_custom_totals_row_formula(self, is_r1c1, is_local) | 获取此列表列的总计行的公式。 |
set_custom_totals_row_formula(self, formula, is_r1c1, is_local) | 获取此列表列的总计行的公式。 |
get_custom_calculated_formula(self, is_r1c1, is_local) | 获取此列表列的公式。 |
set_custom_calculated_formula(self, formula, is_r1c1, is_local) | 设置此列表列的公式。 |
get_data_style(self) | 获取表格该列数据的样式。 |
set_data_style(self, style) | 设置表格此列数据的样式。 |
例子
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(4):
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
listColumn = table.list_columns[4]
listColumn.totals_calculation = TotalsCalculation.SUM
listColumn.formula = "=[A]"
workbook.save(r"Book1.xlsx")