[]
Gets or sets whether the PivotTable report shows grand totals for columns.
This property indicates whether a grand total is displayed for the column
area of the PivotTable report. The default value is true.
bool ColumnGrand { get; set; }
Property ColumnGrand As Boolean
worksheet.Range["A1:B5"].Value = new object[,] {
{"Category", "Amount"},
{"Fruit", 120},
{"Fruit", 80},
{"Vegetables", 95},
{"Vegetables", 60}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:B5"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["D1"], "SalesPivot");
pivotTable.PivotFields["Category"].Orientation = PivotFieldOrientation.ColumnField;
pivotTable.PivotFields["Amount"].Orientation = PivotFieldOrientation.DataField;
bool showColumnGrand = pivotTable.ColumnGrand;