[]
Gets the pivot filter at the specified index.
Use this property to access a filter that has already been added to the current IPivotFilters collection.
IPivotFilter this[int index] { get; }
ReadOnly Default Property Item(index As Integer) As IPivotFilter
| Type | Name | Description |
|---|---|---|
| int | index | The zero-based index of the pivot filter to get. |
worksheet.Range["A1:B4"].Value = new object[,] {
{"Product", "Amount"},
{"Apple", 100},
{"Pear", 200},
{"Avocado", 150}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:B4"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["D1"], "PivotTable1");
IPivotField productField = pivotTable.PivotFields["Product"];
productField.Orientation = PivotFieldOrientation.RowField;
pivotTable.PivotFields["Amount"].Orientation = PivotFieldOrientation.DataField;
productField.PivotFilters.Add(PivotFilterType.CaptionContains, "A");
IPivotFilter filter = productField.PivotFilters[0];