Represents a filter applied to a PivotTable field.
To create a new filter and apply it 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 items that meet the specified criteria (Label Filters and Date Filters), or filter report data based on calculated values (Value Filters).
The example below demonstrates how to apply a label filter to the "Region" field to display sales data only for the Southern region.
A complete sample project is available at https://github.com/DevExpress-Examples/winforms-spreadsheet-pivot-table-api-t298650
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")
Worksheet worksheet = workbook.Worksheets["Report4"]; workbook.Worksheets.ActiveWorksheet = worksheet; // Access the pivot table by its name in the collection. PivotTable pivotTable = worksheet.PivotTables["PivotTable1"]; // Access the "Region" field. PivotField field = pivotTable.Fields; // Filter the "Region" field by text to display sales data for the "South" region. pivotTable.Filters.Add(field, PivotFilterType.CaptionEqual, "South");