Back to Devexpress

PivotLayout.SetReportLayout(PivotReportLayout) Method

officefileapi-devexpress-dot-spreadsheet-dot-pivotlayout-dot-setreportlayout-x28-devexpress-dot-spreadsheet-dot-pivotreportlayout-x29.md

latest7.6 KB
Original Source

PivotLayout.SetReportLayout(PivotReportLayout) Method

Applies the specified report layout to a pivot table.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
void SetReportLayout(
    PivotReportLayout layout
)
vb
Sub SetReportLayout(
    layout As PivotReportLayout
)

Parameters

NameTypeDescription
layoutPivotReportLayout

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.

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

View Example

csharp
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);
vb
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")
' Display the pivot table in the outline form.
pivotTable.Layout.SetReportLayout(PivotReportLayout.Outline)

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.

wpf-spreadsheet-pivot-table-api-examples/CS/SpreadsheetWPFPivotTableExamples/CodeExamples/PivotTableLayoutActions.cs#L60

csharp
// Display the pivot table in the tabular form.
pivotTable.Layout.SetReportLayout(PivotReportLayout.Tabular);
// Merge and center cells with labels.

winforms-spreadsheet-pivot-table-api/CS/SpreadsheetPivotTableExamples/CodeExamples/PivotTableLayoutActions.cs#L60

csharp
// Display the pivot table in the tabular form.
pivotTable.Layout.SetReportLayout(PivotReportLayout.Tabular);
// Merge and center cells with labels.

spreadsheet-document-api-pivot-table-examples/CS/SpreadsheetDocServerPivotAPI/CodeExamples/PivotTableLayoutActions.cs#L74

csharp
// Display the pivot table in the tabular form.
pivotTable.Layout.SetReportLayout(PivotReportLayout.Tabular);
// Merge and center cells with labels.

wpf-spreadsheet-pivot-table-api-examples/VB/SpreadsheetWPFPivotTableExamples/CodeExamples/PivotTableLayoutActions.vb#L58

vb
' Display the pivot table in the tabular form.
pivotTable.Layout.SetReportLayout(PivotReportLayout.Tabular)
' Merge and center cells with labels.

winforms-spreadsheet-pivot-table-api/VB/SpreadsheetPivotTableExamples/CodeExamples/PivotTableLayoutActions.vb#L58

vb
' Display the pivot table in the tabular form.
pivotTable.Layout.SetReportLayout(PivotReportLayout.Tabular)
' Merge and center cells with labels.

spreadsheet-document-api-pivot-table-examples/VB/SpreadsheetDocServerPivotAPI/CodeExamples/PivotTableLayoutActions.vb#L68

vb
' Display the pivot table in the tabular form.
pivotTable.Layout.SetReportLayout(PivotReportLayout.Tabular)
' Merge and center cells with labels.

See Also

PivotLayout Interface

PivotLayout Members

DevExpress.Spreadsheet Namespace