Skip to main content
A newer version of this page is available. .
Row

PivotTable.PageFields Property

Provides access to the collection of fields located in the PivotTable’s report filter area.

Namespace: DevExpress.Spreadsheet

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

Declaration

PivotPageFieldCollection PageFields { get; }

Property Value

Type Description
PivotPageFieldCollection

A PivotPageFieldCollection object that represents the collection of page fields.

Remarks

Use the PageFields property to get access to the collection that stores all page fields added to the PivotTable report. An individual page field can be accessed by its index or name in the collection.

To add a new page field to the pivot table, use the PivotPageFieldCollection.Add method. To add a field to the report filter area at the specified position, use the PivotPageFieldCollection.Insert method.

To remove a page field from the PivotTable report, use the PivotPageFieldCollection.Remove or PivotPageFieldCollection.RemoveAt method. You can also use the PivotPageFieldCollection.Clear method to remove all fields from the PivotTable’s report filter area at once.

Example

Dim sourceWorksheet As Worksheet = workbook.Worksheets("Data1")
Dim worksheet As Worksheet = workbook.Worksheets.Add()
workbook.Worksheets.ActiveWorksheet = worksheet

' Create a pivot table.
Dim pivotTable As PivotTable = worksheet.PivotTables.Add(sourceWorksheet("A1:D41"), worksheet("B2"))

' Add the "Product" field to the row axis area.
pivotTable.RowFields.Add(pivotTable.Fields("Product"))
' Add the "Category" field to the column axis area.
pivotTable.ColumnFields.Add(pivotTable.Fields("Category"))
' Add the "Sales" field to the data area and specify the custom field name.
Dim dataField As PivotDataField = pivotTable.DataFields.Add(pivotTable.Fields("Sales"), "Sales(Sum)")
' Specify the number format for the "Sales" field.
dataField.NumberFormat = "_([$$-409]* #,##0.00_);_([$$-409]* (#,##0.00);_([$$-409]* "" - ""??_);_(@_)"
' Add the "Region" field to the filter area.
pivotTable.PageFields.Add(pivotTable.Fields("Region"))
See Also