PivotLayout.SetReportLayout(PivotReportLayout) Method
Applies the specified report layout to a pivot table.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v24.2.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
Declaration
Parameters
Name | Type | Description |
---|---|---|
layout | PivotReportLayout | One of the PivotReportLayout enumeration members specifying the report layout. |
Remarks
Use the SetReportLayout method to change the layout of your PivotTable report to make it easier to read and understand. The available report layouts are listed below.
Compact layout (PivotReportLayout.Compact)
This is the default layout for a newly created pivot table. Use this layout to keep your report as narrow as possible. It displays items from different row fields in a single column and subsidiary row field items are shown indented from the left. To control the amount of indentation, use the PivotLayout.IndentInCompactForm property.
Outline layout (PivotReportLayout.Outline)
This layout displays each row field in its own column. Subsidiary row field items begin one row below the parent field item.
Tabular layout (PivotReportLayout.Tabular)
Like the outline layout, the tabular layout displays each row field in its own column, but subsidiary row field items begin on the same row.
By default, the compact and outline layouts display subtotals for each item in the outer row fields at top. However, you can change the subtotal location and display subtotals below the subtotaled rows by using the PivotLayout.ShowAllSubtotals method with the false parameter. The tabular layout always displays subtotals for each item in the outer row fields at the bottom, irrespective of the value of the boolean parameter of the PivotLayout.ShowAllSubtotals method. If you wish to turn off the display of subtotals, call the PivotLayout.HideAllSubtotals method.
For the outline or tabular layout, you can also specify how to display item labels for the row and column fields. By default, items of the outermost column and row fields are displayed only once, while items in the remaining column and row fields are repeated as needed. If you wish to repeat item labels in all outer row and column fields, call the PivotLayout.RepeatAllItemLabels method. To repeat item labels in a particular field, use the PivotFieldLayout.RepeatItemLabels property.
Example
Worksheet worksheet = workbook.Worksheets["Report1"];
workbook.Worksheets.ActiveWorksheet = worksheet;
// Access the pivot table by its name in the collection.
PivotTable pivotTable = worksheet.PivotTables["PivotTable1"];
// Display the pivot table in the outline form.
pivotTable.Layout.SetReportLayout(PivotReportLayout.Outline);
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the SetReportLayout(PivotReportLayout) method.
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.