[]
Represents optional settings for a pivot filter.
Use this class to provide additional configuration when adding a pivot filter with Add(PivotFilterType, object, object, PivotFilterOptions). It contains settings used by value filters, date filters, and Top 10 filters, such as the filter name, description, referenced data field, whole-day date matching, and top-or-bottom selection behavior.
public class PivotFilterOptions
Public Class PivotFilterOptions
worksheet.Range["A1:B5"].Value = new object[,] {
{"Product", "Amount"},
{"Example Speaker", 4270},
{"Example Camera", 8239},
{"Example TV", 2626},
{"Example Smartphone", 8250}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:B5"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["D1"], "SalesPivot");
IPivotField productField = pivotTable.PivotFields["Product"];
productField.Orientation = PivotFieldOrientation.RowField;
IPivotField amountField = pivotTable.PivotFields["Amount"];
amountField.Orientation = PivotFieldOrientation.DataField;
PivotFilterOptions options = new PivotFilterOptions();
options.AppliedDataField = 0;
IPivotFilter filter = productField.PivotFilters.Add(PivotFilterType.ValueGreaterThan, 7000, null, options);
IPivotField dataField = filter.DataField;
| Name | Description |
|---|---|
| PivotFilterOptions() |
| Name | Description |
|---|---|
| AppliedDataField | Gets or sets the value filter setting. Specifies which DataField the current field is filtered by. The returned value represents the index of the referenced DataField in the DataFields collection. |
| Description | Gets or sets a brief description of the filter. |
| IsTop10Type | Gets or sets the selection direction for a Top 10 pivot filter.
Returns |
| Name | Gets or sets the name of the filter. Returns the name assigned to this PivotFilterOptions instance. |
| WholeDayFilter | Gets or sets a value indicating whether the date filter should use whole days in its filtering criteria. This option is used with Add(PivotFilterType, object, object, PivotFilterOptions) when creating a date filter and determining whether the filter criteria should match by whole day instead of by time. |