PivotTable.Filters Property
Provides access to the collection of filters applied to the current pivot table.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v24.2.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
Declaration
Property Value
Type | Description |
---|---|
PivotFilterCollection | A PivotFilterCollection object that is a collection of pivot filters. |
Remarks
Use the Filters property to access the collection of filters applied to the specified PivotTable report. To add a new filter to a specific row or column field in the pivot table, use the PivotFilterCollection.Add method overloads. Different types of filters are available: you can construct the filter expression to display only items that meet the specified condition (Label Filters and Date Filters), or filter report data based on calculated values (Value Filters).
To remove a filter from a PivotTable field, use the PivotFilter.Delete method or remove the filter from the PivotFilterCollection collection by using the PivotFilterCollection.Remove or PivotFilterCollection.RemoveAt method. Note that you can also use the PivotField.ShowAllItems method to redisplay all items in a filtered field.
To clear all filters applied to the PivotTable fields, call the PivotFilterCollection.Clear method.
Example
Dim worksheet As Worksheet = workbook.Worksheets("Report4")
workbook.Worksheets.ActiveWorksheet = worksheet
' Access the pivot table by its name in the collection.
Dim pivotTable As PivotTable = worksheet.PivotTables("PivotTable1")
' Access the "Region" field.
Dim field As PivotField = pivotTable.Fields(0)
' Filter the "Region" field by text to display sales data for the "South" region.
pivotTable.Filters.Add(field, PivotFilterType.CaptionEqual, "South")