officefileapi-devexpress-dot-spreadsheet-dot-pivotlayout-9d07cd1c.md
Gets or sets a value indicating whether grand totals should be displayed for columns in the PivotTable report.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
bool ShowColumnGrandTotals { get; set; }
Property ShowColumnGrandTotals As Boolean
| Type | Description |
|---|---|
| Boolean |
true , to display grand totals for columns; otherwise, false.
|
Use the ShowColumnGrandTotals and PivotLayout.ShowRowGrandTotals properties to display or hide grand totals for a PivotTable report. The PivotTable row displaying grand totals for columns is highlighted in the following image. The appearance of the grand total row is specified by the TableStyleElementType.TotalRow element of the style applied to the pivot table.
The following example demonstrates how to use the ShowColumnGrandTotals property to hide grand totals for the PivotTable columns.
Worksheet worksheet = workbook.Worksheets["Report1"];
workbook.Worksheets.ActiveWorksheet = worksheet;
// Access the pivot table by its name in the collection.
PivotTable pivotTable = worksheet.PivotTables["PivotTable1"];
// Add the "Region" field to the column axis area.
pivotTable.ColumnFields.Add(pivotTable.Fields["Region"]);
// Hide grand totals for columns.
pivotTable.Layout.ShowColumnGrandTotals = false;
Dim worksheet As Worksheet = workbook.Worksheets("Report1")
workbook.Worksheets.ActiveWorksheet = worksheet
' Access the pivot table by its name in the collection.
Dim pivotTable As PivotTable = worksheet.PivotTables("PivotTable1")
' Add the "Region" field to the column axis area.
pivotTable.ColumnFields.Add(pivotTable.Fields("Region"))
' Hide grand totals for columns.
pivotTable.Layout.ShowColumnGrandTotals = False
The following code snippets (auto-collected from DevExpress Examples) contain references to the ShowColumnGrandTotals property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
// Hide grand totals for columns.
pivotTable.Layout.ShowColumnGrandTotals = false;
#endregion #ColumnGrandTotals
// Hide grand totals for columns.
pivotTable.Layout.ShowColumnGrandTotals = false;
#endregion #ColumnGrandTotals
// Hide grand totals for columns.
pivotTable.Layout.ShowColumnGrandTotals = false;
#endregion #ColumnGrandTotals
' Hide grand totals for columns.
pivotTable.Layout.ShowColumnGrandTotals = False
' #End Region ' #ColumnGrandTotals
' Hide grand totals for columns.
pivotTable.Layout.ShowColumnGrandTotals = False
' #End Region ' #ColumnGrandTotals
' Hide grand totals for columns.
pivotTable.Layout.ShowColumnGrandTotals = False
#End Region ' #ColumnGrandTotals
See Also