Class ListColumn
Namespace: Aspose.Cells.Tables
Assembly: Aspose.Cells.dll (25.2.0)
Represents a column in a Table.
public class ListColumn
Inheritance
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Examples
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");
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")
Properties
Formula
Gets and sets the formula of the list column.
public string Formula { get; set; }
Property Value
Name
Gets and sets the name of the column.
public string Name { get; set; }
Property Value
Remarks
If sets the name of the column, the according cell’ value will be changed too.
Range
Gets the range of this list column.
public Range Range { get; }
Property Value
TotalsCalculation
Gets and sets the type of calculation in the Totals row of the list column.
public TotalsCalculation TotalsCalculation { get; set; }
Property Value
TotalsRowLabel
Gets and sets the display labels of total row.
public string TotalsRowLabel { get; set; }
Property Value
Methods
GetCustomCalculatedFormula(bool, bool)
Gets the formula of this list column.
public string GetCustomCalculatedFormula(bool isR1C1, bool isLocal)
Parameters
isR1C1
bool
Whether the formula needs to be formatted as R1C1.
isLocal
bool
Whether the formula needs to be formatted by locale.
Returns
The formula of this list column.
GetCustomTotalsRowFormula(bool, bool)
Gets the formula of totals row of this list column.
public string GetCustomTotalsRowFormula(bool isR1C1, bool isLocal)
Parameters
isR1C1
bool
Whether the formula needs to be formatted as R1C1.
isLocal
bool
Whether the formula needs to be formatted by locale.
Returns
The formula of this list column.
GetDataStyle()
Gets the style of the data in this column of the table.
public Style GetDataStyle()
Returns
SetCustomCalculatedFormula(string, bool, bool)
Sets the formula for this list column.
public void SetCustomCalculatedFormula(string formula, bool isR1C1, bool isLocal)
Parameters
formula
string
the formula for this list column.
isR1C1
bool
Whether the formula needs to be formatted as R1C1.
isLocal
bool
Whether the formula needs to be formatted by locale.
SetCustomTotalsRowFormula(string, bool, bool)
Gets the formula of totals row of this list column.
public void SetCustomTotalsRowFormula(string formula, bool isR1C1, bool isLocal)
Parameters
formula
string
the formula for this list column.
isR1C1
bool
Whether the formula needs to be formatted as R1C1.
isLocal
bool
Whether the formula needs to be formatted by locale.
SetDataStyle(Style)
Sets the style of the data in this column of the table.
public void SetDataStyle(Style style)
Parameters
style
Style