Class ExcelPivotTableFieldFilterCollection
A collection of pivot filters for a pivot table field
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 |
| string | value1 | Value 1 |
| 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, 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. |
| DateTime | value1 | Value 1 |
| DateTime? | value2 | Value 2. Set to null, if not used |
Returns
| Type | Description |
|---|---|
| ExcelPivotTableFilter | The pivot table filter |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if value is between and |
AddTop10Filter(ePivotTableTop10FilterType, ExcelPivotTableDataField, double, bool)
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 |
| double | value | The top or bottom value to relate to |
| bool | isTop | Top or bottom. true is Top, false is Bottom |
Returns
| Type | Description |
|---|---|
| ExcelPivotTableFilter |
AddTop10Filter(ePivotTableTop10FilterType, int, double, bool)
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 |
| int | dataFieldIndex | The index to the data field within the pivot tables DataField collection |
| double | value | The top or bottom value to relate to |
| bool | 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 |
| object | value1 | Value 1 |
| object | value2 | Value 2. Used with ValueBetween and ValueNotBetween |
Returns
| Type | Description |
|---|---|
| ExcelPivotTableFilter | The pivot table filter |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | If the data field is not present in the pivot table. |
| ArgumentNullException | If value2 is not set when type is set to between |
AddValueFilter(ePivotTableValueFilterType, int, 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 |
| int | dataFieldIndex | The index of the ExcelPivotTableDataField to apply the filter to. |
| object | value1 | Value 1 |
| object | value2 | Value 2. Used with ValueBetween and ValueNotBetween |
Returns
| Type | Description |
|---|---|
| ExcelPivotTableFilter | The pivot table filter |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | If the data field is not present in the pivot table. |
| ArgumentNullException | If value2 is not set when type is set to between |