Skip to main content
Row

PivotPageField Interface

Represents a reference to a PivotField object that is currently shown as a page field.

Namespace: DevExpress.Spreadsheet

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

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

public interface PivotPageField :
    PivotFieldReferenceBase

Remarks

The PivotPageField object is a member of the PivotPageFieldCollection collection, which stores all page fields of a PivotTable report. An individual PivotPageField object can be accessed by its name or index in the collection using the PivotPageFieldCollection.Item property.

To add a PivotField to the PivotTable’s report filter area, use the PivotPageFieldCollection.Add method.

View 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"))

To re-order fields in the report filter area, use the PivotFieldReferenceBase.MoveDown, PivotFieldReferenceBase.MoveUp, PivotFieldReferenceBase.MoveToBeginning or PivotFieldReferenceBase.MoveToEnd method of the PivotPageField object whose position you wish to change.

To remove a page field from the pivot table, use the PivotPageFieldCollection.Remove or PivotPageFieldCollection.RemoveAt method.

See Also