[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IPivotField.Subtotals

Subtotals Property

Subtotals

Gets or sets the combination of subtotal types currently shown for this PivotField.

This method is valid only for nondata fields. Use it to inspect which SubtotalType values are enabled for the field.

Declaration
SubtotalType Subtotals { get; set; }
Property Subtotals As SubtotalType
Examples
worksheet.Range["A1:B4"].Value = new object[,] {
    {"Category", "Amount"},
    {"Beverages", 100},
    {"Beverages", 200},
    {"Snacks", 150}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:B4"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["D1"], "pivotTable1");
IPivotField categoryField = pivotTable.PivotFields["Category"];
categoryField.Orientation = PivotFieldOrientation.RowField;
pivotTable.PivotFields["Amount"].Orientation = PivotFieldOrientation.DataField;
categoryField.Subtotals = SubtotalType.Sum | SubtotalType.Count;
SubtotalType subtotals = categoryField.Subtotals;