Back to Devexpress

PivotBehaviorOptions Interface

officefileapi-devexpress-dot-spreadsheet-ecd89022.md

latest3.3 KB
Original Source

PivotBehaviorOptions Interface

Contains options that allow you to restrict specific operations in the PivotTable report.

Namespace : DevExpress.Spreadsheet

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
public interface PivotBehaviorOptions
vb
Public Interface PivotBehaviorOptions

The following members return PivotBehaviorOptions objects:

Remarks

An object exposing the PivotBehaviorOptions interface is accessible using the PivotTable.Behavior property. Utilize the object’s properties to disable the capability to display the PivotTable Field List (PivotBehaviorOptions.EnableFieldList), preserve the custom column widths in a pivot table so that they don’t change when the pivot table is recalculated or refreshed (PivotBehaviorOptions.AutoFitColumns), or specify whether a PivotTable field can have multiple filters applied to it at the same time (PivotBehaviorOptions.AllowMultipleFieldFilters).

Example

View Example

vb
Dim worksheet As Worksheet = workbook.Worksheets("Report1")
workbook.Worksheets.ActiveWorksheet = worksheet
worksheet.Columns("B").WidthInCharacters = 40

' Access the pivot table by its name in the collection.
Dim pivotTable As PivotTable = worksheet.PivotTables("PivotTable1")

' Restrict specific operations for the pivot table.
Dim behaviorOptions As PivotBehaviorOptions = pivotTable.Behavior
behaviorOptions.AutoFitColumns = False
behaviorOptions.EnableFieldList = False

' Refresh the pivot table.
pivotTable.Cache.Refresh()
csharp
Worksheet worksheet = workbook.Worksheets["Report1"];
workbook.Worksheets.ActiveWorksheet = worksheet;
worksheet.Columns["B"].WidthInCharacters = 40;

// Access the pivot table by its name in the collection.
PivotTable pivotTable = worksheet.PivotTables["PivotTable1"];

// Restrict specific operations for the pivot table.
PivotBehaviorOptions behaviorOptions = pivotTable.Behavior;
behaviorOptions.AutoFitColumns = false;
behaviorOptions.EnableFieldList = false;

// Refresh the pivot table.
pivotTable.Cache.Refresh();

See Also

PivotBehaviorOptions Members

DevExpress.Spreadsheet Namespace