ListColumn

ListColumn class

Represents a column in a list.

public class ListColumn

Properties

Name Description
Formula { get; set; } Gets and sets the formula of the list column.
Name { get; set; } Gets and sets the name of the column.
Range { get; } Gets the range of this list column.
TotalsCalculation { get; set; } Gets and sets the type of calculation in the Totals row of the list column.

Methods

Name Description
GetCustomCalculatedFormula(bool, bool) Gets the formula of this list column.
GetCustomTotalsRowFormula(bool, bool) Gets the formula of totals row of this list column.
SetCustomCalculatedFormula(string, bool, bool) Sets the formula for this list column.
SetCustomTotalsRowFormula(string, bool, bool) Gets the formula of totals row of this list column.

Examples


[C#]


Workbook workbook = new Workbook();
Cells cells = workbook.Worksheets[0].Cells;
for (int i = 0; i  <5; i++)
{
cells[0,i].PutValue(CellsHelper.ColumnIndexToName(i));
 }
for (int row = 1; row  <10; row++)
{
 for (int column = 0; column  <4; column++)
{
cells[row, column].PutValue(row * column);
 }
 }
ListObjectCollection tables = workbook.Worksheets[0].ListObjects;
int index = tables.Add(0, 0, 9, 4, true);
ListObject table = tables[0];
table.ShowTotals = true;
ListColumn listColumn = table.ListColumns[4];
listColumn.TotalsCalculation = Aspose.Cells.Tables.TotalsCalculation.Sum;
listColumn.Formula = "=[A]";
workbook.Save(@"Book1.xlsx");


[Visual Basic]

Dim workbook As Workbook = New Workbook()
Dim cells As Cells = workbook.Worksheets(0).Cells
For i As Int32 = 0 To 4
 cells(0, i).PutValue(CellsHelper.ColumnIndexToName(i))
Next
For row As Int32 = 1 To 9
 For column As Int32 = 0 To 3
  cells(row, column).PutValue(row * column)
Next
Next
Dim tables As ListObjectCollection = workbook.Worksheets(0).ListObjects
Dim index As Int32 = tables.Add(0, 0, 9, 4, True)
Dim table As ListObject = tables(0)
table.ShowTotals = True
Dim listColumn as ListColumn = table.ListColumns(4);
listColumn.TotalsCalculation = Aspose.Cells.Tables.TotalsCalculation.Sum;
listColumn.Formula = "=[A]";
workbook.Save("Book1.xlsx")

See Also