PivotFieldCollection Class
Represents a collection of PivotFields.
public sealed class PivotFieldCollection : PivotFieldBaseCollection, IEnumerable<PivotField>, IEnumerable
Public NotInheritable Class PivotFieldCollection
Inherits PivotFieldBaseCollection
Implements IEnumerable(Of PivotField), IEnumerable
- Inheritance:
- System.ObjectPivotFieldCollection
Methods
AddCalculated(String, String)
Adds a calculated PivotField to the end of the collection of PivotTable fields.
public PivotField AddCalculated(string fieldName, string formula)
Public Function AddCalculated(fieldName As String, formula As String) As PivotField
Parameters
fieldName
- System.String
The name of the calculated PivotField.
formula
- System.String
The formula of the calculated PivotField.
Returns
Newly created PivotField.
Exceptions
- System.InvalidOperationException
PivotTable created from non-worksheet data source cannot be modified.
- System.ArgumentException
fieldName
can't be null or System.String.Empty.
- System.ArgumentException
formula
can't be null or System.String.Empty.
- System.ArgumentException
fieldName
must be unique.
RemoveCalculated(String)
Removes the calculated PivotField from the collection of PivotTable fields.
public void RemoveCalculated(string fieldName)
Public Sub RemoveCalculated(fieldName As String)
Parameters
fieldName
- System.String
The name of the calculated PivotField.
Exceptions
- System.InvalidOperationException
PivotTable created from non-worksheet data source cannot be modified.
- System.ArgumentException
fieldName
can't be null or System.String.Empty.
- System.ArgumentException
Field with specified name doesn't exist.
- System.ArgumentException
Field with specified name is not a calculated field.
Inherited Properties
Count | Gets the number of PivotFields contained in the collection. (Inherited from PivotFieldBaseCollection) |
Item[System.Int32] | Gets the PivotField at the specified index. (Inherited from PivotFieldBaseCollection) |
Item[System.String] | Gets the PivotField with the specified name. (Inherited from PivotFieldBaseCollection) |
Inherited Methods
Contains(PivotField) | Determines whether the PivotField is contained in the collection. (Inherited from PivotFieldBaseCollection) |
GetEnumerator() | Returns an enumerator for the collection. (Inherited from PivotFieldBaseCollection) |
IndexOf(PivotField) | Searches for the specified PivotField and returns the zero-based index of the first occurrence within the entire collection. (Inherited from PivotFieldBaseCollection) |