Click or drag to resize

IListObjectColumn TotalsCalculation Property

Gets or sets function used for totals calculation.
Examples
The following code illustrates how to set IListObject.ShowTotals to "True" to enable totals and set ExcelTotalsCalculation.Sum for second and third columns to get sum of values in the respective columns:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create table</para><para>IListObject table1 = worksheet.ListObjects.Create("Table1", worksheet["A1:C6"]);</para><para>//Total row</para><para>table1.ShowTotals = true;</para><para>table1.Columns[0].TotalsRowLabel = "Total";</para><para>table1.Columns[1].TotalsCalculation = ExcelTotalsCalculation.Sum;</para><para>table1.Columns[2].TotalsCalculation = ExcelTotalsCalculation.Sum;</para><para>//Save to file</para><para>workbook.SaveToFile("Table.xlsx");</para>

Namespace: Spire.Xls.Core
Assembly: Spire.XLS (in Spire.XLS.dll) Version: 15.4.0.0 (15.4.0.5046)
Syntax
ExcelTotalsCalculation TotalsCalculation { get; set; }

Property Value

Type: ExcelTotalsCalculation
See Also