[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IPivotTable.SubtotalLocation

SubtotalLocation Method

SubtotalLocation(SubtotalLocationType)

Changes the subtotal location for all existing pivot fields.

Changing the subtotal location has an immediate visual effect only for fields in outline form, but the setting is also applied to fields in tabular form.

If the row axis layout is TabularRow, the location must be Bottom.

Declaration
void SubtotalLocation(SubtotalLocationType location)
Sub SubtotalLocation(location As SubtotalLocationType)
Parameters
Type Name Description
SubtotalLocationType location

The subtotal location to apply to all existing pivot fields.

Examples
worksheet.Range["A1:B4"].Value = new object[,] {
    {"Category", "Amount"},
    {"Beverages", 100},
    {"Snacks", 200},
    {"Beverages", 150}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:B4"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["D1"]);
pivotTable.PivotFields["Category"].Orientation = PivotFieldOrientation.RowField;
pivotTable.PivotFields["Amount"].Orientation = PivotFieldOrientation.DataField;
pivotTable.SubtotalLocation(SubtotalLocationType.Bottom);
Exceptions
Type Condition
ArgumentException

If the row axis layout is TabularRow and location is not Bottom.