[]
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.
public int AppliedDataField { get; set; }
Public Property AppliedDataField As Integer
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;