Class ListColumn
Contents
[
Hide
]ListColumn class
Represents a column in a Table.
public class ListColumn
Properties
Name | Description |
---|---|
Formula { get; set; } | Gets and sets the formula of the list column. |
IsArrayFormula { get; } | Indicates whether the fomula is array formula. |
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. |
TotalsRowLabel { get; set; } | Gets and sets the display labels of total row. |
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. |
GetDataStyle() | Gets the style of the data in this column of the table. |
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. |
SetDataStyle(Style) | Sets the style of the data in this column of the table. |
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using Aspose.Cells.Tables;
using System;
public class ListColumnDemo
{
public static void ListColumnExample()
{
// Create a new workbook and access the first worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
Cells cells = worksheet.Cells;
// Populate the worksheet with some data
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);
}
}
// Add a ListObject (table) to the worksheet
ListObjectCollection tables = worksheet.ListObjects;
int index = tables.Add(0, 0, 9, 4, true);
ListObject table = tables[index];
table.ShowTotals = true;
// Access the ListColumn and set its properties
ListColumn listColumn = table.ListColumns[4];
listColumn.TotalsCalculation = TotalsCalculation.Sum;
listColumn.Formula = "=[A]";
listColumn.Name = "CustomColumn";
listColumn.TotalsRowLabel = "Total";
// Save the workbook
workbook.Save("ListColumnExample.xlsx");
}
}
}
See Also
- namespace Aspose.Cells.Tables
- assembly Aspose.Cells