Class ExcelPivotTableFieldFilterCollection
A collection of pivot filters for a pivot table field
Implements
Inherited Members
Namespace: OfficeOpenXml.Table.PivotTable.Filter
Assembly: EPPlus.dll
Syntax
public class ExcelPivotTableFieldFilterCollection : ExcelPivotTableFilterBaseCollection, IEnumerable<ExcelPivotTableFilter>, IEnumerable
Methods
AddCaptionFilter(ePivotTableCaptionFilterType, String, String)
Adds a caption (label) filter for a pivot tabel field
Declaration
public ExcelPivotTableFilter AddCaptionFilter(ePivotTableCaptionFilterType type, string value1, string value2 = null)
Parameters
Type | Name | Description |
---|---|---|
ePivotTableCaptionFilterType | type | The type of pivot table caption filter |
System.String | value1 | Value 1 |
System.String | value2 | Value 2. Set to null, if not used |
Returns
Type | Description |
---|---|
ExcelPivotTableFilter |
AddDatePeriodFilter(ePivotTableDatePeriodFilterType)
Adds a date period filter for a pivot table field.
Declaration
public ExcelPivotTableFilter AddDatePeriodFilter(ePivotTableDatePeriodFilterType type)
Parameters
Type | Name | Description |
---|---|---|
ePivotTableDatePeriodFilterType | type | The type of field. |
Returns
Type | Description |
---|---|
ExcelPivotTableFilter | The pivot table filter |
AddDateValueFilter(ePivotTableDateValueFilterType, DateTime, Nullable<DateTime>)
Adds a date filter for a pivot table field
Declaration
public ExcelPivotTableFilter AddDateValueFilter(ePivotTableDateValueFilterType type, DateTime value1, DateTime? value2 = null)
Parameters
Type | Name | Description |
---|---|---|
ePivotTableDateValueFilterType | type | The type of pivot table filter. |
System.DateTime | value1 | Value 1 |
System.Nullable<System.DateTime> | value2 | Value 2. Set to null, if not used |
Returns
Type | Description |
---|---|
ExcelPivotTableFilter | The pivot table filter |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if value is between and |
AddTop10Filter(ePivotTableTop10FilterType, ExcelPivotTableDataField, Double, Boolean)
Adds a top 10 filter to the field
Declaration
public ExcelPivotTableFilter AddTop10Filter(ePivotTableTop10FilterType type, ExcelPivotTableDataField dataField, double value, bool isTop = true)
Parameters
Type | Name | Description |
---|---|---|
ePivotTableTop10FilterType | type | The top-10 filter type |
ExcelPivotTableDataField | dataField | The datafield within the pivot table |
System.Double | value | The top or bottom value to relate to |
System.Boolean | isTop | Top or bottom. true is Top, false is Bottom |
Returns
Type | Description |
---|---|
ExcelPivotTableFilter |
AddTop10Filter(ePivotTableTop10FilterType, Int32, Double, Boolean)
Adds a top 10 filter to the field
Declaration
public ExcelPivotTableFilter AddTop10Filter(ePivotTableTop10FilterType type, int dataFieldIndex, double value, bool isTop = true)
Parameters
Type | Name | Description |
---|---|---|
ePivotTableTop10FilterType | type | The top-10 filter type |
System.Int32 | dataFieldIndex | The index to the data field within the pivot tables DataField collection |
System.Double | value | The top or bottom value to relate to |
System.Boolean | isTop | Top or bottom. true is Top, false is Bottom |
Returns
Type | Description |
---|---|
ExcelPivotTableFilter |
AddValueFilter(ePivotTableValueFilterType, ExcelPivotTableDataField, Object, Object)
Adds a pivot table value filter.
Declaration
public ExcelPivotTableFilter AddValueFilter(ePivotTableValueFilterType type, ExcelPivotTableDataField dataField, object value1, object value2 = null)
Parameters
Type | Name | Description |
---|---|---|
ePivotTableValueFilterType | type | The type of value filter |
ExcelPivotTableDataField | dataField | The data field to apply the filter to |
System.Object | value1 | Value 1 |
System.Object | value2 | Value 2. Used with ValueBetween and ValueNotBetween |
Returns
Type | Description |
---|---|
ExcelPivotTableFilter | The pivot table filter |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | If the data field is not present in the pivot table. |
System.ArgumentNullException | If value2 is not set when type is set to between |
AddValueFilter(ePivotTableValueFilterType, Int32, Object, Object)
Adds a pivot table value filter.
Declaration
public ExcelPivotTableFilter AddValueFilter(ePivotTableValueFilterType type, int dataFieldIndex, object value1, object value2 = null)
Parameters
Type | Name | Description |
---|---|---|
ePivotTableValueFilterType | type | The type of value filter |
System.Int32 | dataFieldIndex | The index of the ExcelPivotTableDataField to apply the filter to. |
System.Object | value1 | Value 1 |
System.Object | value2 | Value 2. Used with ValueBetween and ValueNotBetween |
Returns
Type | Description |
---|---|
ExcelPivotTableFilter | The pivot table filter |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | If the data field is not present in the pivot table. |
System.ArgumentNullException | If value2 is not set when type is set to between |