Represents the collection of all fields in a PivotTable report.
When you create a pivot table, the PivotFieldCollection collection is populated automatically based on information in the source data (or more precisely PivotCache). For example, if you use a cell range as a data source for your PivotTable report, each column in the source range will be treated as a separate field, and the column label will be used as the value of the PivotField.Name property.
To return a collection of all fields in a specific PivotTable report, use the PivotTable.Fields property. An individual PivotTable field is represented by the PivotField object, which can be accessed by its name or index in the collection using the PivotFieldCollection.Item property.
- PivotTable.RowFields returns the collection of row fields.
- PivotTable.ColumnFields returns the collection of column fields.
- PivotTable.DataFields returns the collection of data fields.
- PivotTable.PageFields returns the collection of page fields.
- PivotTable.CalculatedFields returns the collection of calculated fields.