Class ExcelPivotTableField
A pivot table field.
Inherited Members
Namespace: OfficeOpenXml.Table.PivotTable
Assembly: EPPlus.dll
Syntax
public class ExcelPivotTableField : XmlHelper
  Properties
AutoSort
Auto sort for a field. Sort is set on a data field for a row/column field. Use SetAutoSort(ExcelPivotTableDataField, eSortType) to set auto sort Use RemoveAutoSort() to remove auto sort and set this property to null
Declaration
public ExcelPivotAreaAutoSort AutoSort { get; }
  Property Value
| Type | Description | 
|---|---|
| ExcelPivotAreaAutoSort | 
Axis
Type of axis
Declaration
public ePivotFieldAxis Axis { get; }
  Property Value
| Type | Description | 
|---|---|
| ePivotFieldAxis | 
Cache
A reference to the cache for the pivot table field.
Declaration
public ExcelPivotTableCacheField Cache { get; set; }
  Property Value
| Type | Description | 
|---|---|
| ExcelPivotTableCacheField | 
Compact
Compact mode
Declaration
public bool Compact { get; set; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
Filters
Filters used on the pivot table field.
Declaration
public ExcelPivotTableFieldFilterCollection Filters { get; }
  Property Value
| Type | Description | 
|---|---|
| ExcelPivotTableFieldFilterCollection | 
Format
The numberformat to use for the column
Declaration
public string Format { get; set; }
  Property Value
| Type | Description | 
|---|---|
| System.String | 
Grouping
Grouping settings. Null if the field has no grouping otherwise ExcelPivotTableFieldDateGroup or ExcelPivotTableFieldNumericGroup.
Declaration
public ExcelPivotTableFieldGroup Grouping { get; }
  Property Value
| Type | Description | 
|---|---|
| ExcelPivotTableFieldGroup | 
IncludeNewItemsInFilter
A boolean that indicates whether manual filter is in inclusive mode
Declaration
public bool IncludeNewItemsInFilter { get; set; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
Index
The index of the pivot table field
Declaration
public int Index { get; set; }
  Property Value
| Type | Description | 
|---|---|
| System.Int32 | 
IsColumnField
If the field is a column field
Declaration
public bool IsColumnField { get; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
IsDataField
If the field is a datafield
Declaration
public bool IsDataField { get; set; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
IsPageField
If the field is a page field.
Declaration
public bool IsPageField { get; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
IsRowField
If the field is a row field
Declaration
public bool IsRowField { get; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
Items
Pivottable field Items. Used for grouping.
Declaration
public ExcelPivotTableFieldItemsCollection Items { get; }
  Property Value
| Type | Description | 
|---|---|
| ExcelPivotTableFieldItemsCollection | 
MultipleItemSelectionAllowed
Indicates whether the field can have multiple items selected in the page field
Declaration
public bool MultipleItemSelectionAllowed { get; set; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
Name
Name of the field
Declaration
public string Name { get; set; }
  Property Value
| Type | Description | 
|---|---|
| System.String | 
Outline
A boolean that indicates whether the items in this field should be shown in Outline form
Declaration
public bool Outline { get; set; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
PageFieldSettings
Page field settings
Declaration
public ExcelPivotTablePageFieldSettings PageFieldSettings { get; }
  Property Value
| Type | Description | 
|---|---|
| ExcelPivotTablePageFieldSettings | 
ShowAll
Indicates whether to show all items for this field
Declaration
public bool ShowAll { get; set; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
ShowAsCaption
Indicates whether to show the property as a member caption
Declaration
public bool ShowAsCaption { get; set; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
ShowDropDowns
Indicates whether to hide drop down buttons on PivotField headers
Declaration
public bool ShowDropDowns { get; set; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
ShowInFieldList
Indicates whether this hierarchy is omitted from the field list
Declaration
public bool ShowInFieldList { get; set; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
ShowMemberPropertyInCell
Indicates whether to show the member property value in a PivotTable cell
Declaration
public bool ShowMemberPropertyInCell { get; set; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
ShowMemberPropertyToolTip
Indicates whether to show the member property value in a tooltip on the appropriate PivotTable cells
Declaration
public bool ShowMemberPropertyToolTip { get; set; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
Slicer
A slicer attached to the pivot table field. If the field has multiple slicers attached, the first slicer will be returned.
Declaration
public ExcelPivotTableSlicer Slicer { get; }
  Property Value
| Type | Description | 
|---|---|
| ExcelPivotTableSlicer | 
Sort
The type of sort that is applied to this field
Declaration
public eSortType Sort { get; set; }
  Property Value
| Type | Description | 
|---|---|
| eSortType | 
SubTotalFunctions
Enumeration of the different subtotal operations that can be applied to page, row or column fields
Declaration
public eSubTotalFunctions SubTotalFunctions { get; set; }
  Property Value
| Type | Description | 
|---|---|
| eSubTotalFunctions | 
SubtotalTop
The custom text that is displayed for the subtotals label
Declaration
public bool SubtotalTop { get; set; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
Methods
AddDateGrouping(eDateGroupBy)
Add a date grouping on this field.
Declaration
public void AddDateGrouping(eDateGroupBy groupBy)
  Parameters
| Type | Name | Description | 
|---|---|---|
| eDateGroupBy | groupBy | Group by  | 
      
AddDateGrouping(eDateGroupBy, DateTime, DateTime)
Add a date grouping on this field.
Declaration
public void AddDateGrouping(eDateGroupBy groupBy, DateTime startDate, DateTime endDate)
  Parameters
| Type | Name | Description | 
|---|---|---|
| eDateGroupBy | groupBy | Group by  | 
      
| System.DateTime | startDate | Fixed start date. Use DateTime.MinValue for auto  | 
      
| System.DateTime | endDate | Fixed end date. Use DateTime.MaxValue for auto  | 
      
AddDateGrouping(Int32, DateTime, DateTime)
Add a date grouping on this field.
Declaration
public void AddDateGrouping(int days, DateTime startDate, DateTime endDate)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | days | Number of days when grouping on days  | 
      
| System.DateTime | startDate | Fixed start date. Use DateTime.MinValue for auto  | 
      
| System.DateTime | endDate | Fixed end date. Use DateTime.MaxValue for auto  | 
      
AddNumericGrouping(Double, Double, Double)
Add numberic grouping to the field
Declaration
public void AddNumericGrouping(double Start, double End, double Interval)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Double | Start | Start value  | 
      
| System.Double | End | End value  | 
      
| System.Double | Interval | Interval  | 
      
AddSlicer()
Will add a slicer to the pivot table field
Declaration
public ExcelPivotTableSlicer AddSlicer()
  Returns
| Type | Description | 
|---|---|
| ExcelPivotTableSlicer | The Slicer/>  | 
      
RemoveAutoSort()
Remove auto sort and set the AutoSort property to null
Declaration
public void RemoveAutoSort()
  SetAutoSort(ExcelPivotTableDataField, eSortType)
Set auto sort on a data field for this field.
Declaration
public void SetAutoSort(ExcelPivotTableDataField dataField, eSortType sortType = eSortType.Ascending)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ExcelPivotTableDataField | dataField | The data field to sort on  | 
      
| eSortType | sortType | Sort ascending or descending  |