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:
- PivotFieldCollection
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
- String
The name of the calculated PivotField.
formula
- String
The formula of the calculated PivotField.
Returns
Newly created PivotField.
Exceptions
- System.InvalidOperationException
PivotTable created from non-worksheet data source cannot be modified.
fieldName
can't be null or Empty.
formula
can't be null or Empty.
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
- String
The name of the calculated PivotField.
Exceptions
- System.InvalidOperationException
PivotTable created from non-worksheet data source cannot be modified.
fieldName
can't be null or Empty.
Field with specified name doesn't exist.
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[Int32] | Gets the PivotField at the specified index. (Inherited from PivotFieldBaseCollection) |
Item[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) |