[]
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.
SubtotalType Subtotals { get; set; }
Property Subtotals As SubtotalType
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;