ListColumn

ListColumn class

Repräsentiert eine Spalte in einer Liste.

public class ListColumn

Eigenschaften

NameBeschreibung
Formula { get; set; }Holt und setzt die Formel der Listenspalte.
Name { get; set; }Ruft den Namen der Spalte ab und legt ihn fest.
Range { get; }Ruft den Bereich dieser Listenspalte ab.
TotalsCalculation { get; set; }Liest und setzt die Art der Berechnung in der Summenzeile der Listenspalte.

Methoden

NameBeschreibung
GetCustomCalculatedFormula(bool, bool)Ruft die Formel dieser Listenspalte ab.
GetCustomTotalsRowFormula(bool, bool)Ruft die Summenformelzeile dieser Listenspalte ab.
SetCustomCalculatedFormula(string, bool, bool)Legt die Formel für diese Listenspalte fest.
SetCustomTotalsRowFormula(string, bool, bool)Ruft die Summenformelzeile dieser Listenspalte ab.

Beispiele


[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")

Siehe auch