Class PivotAreaFilterCollection

PivotAreaFilterCollection class

Represents the list of filters for PivotArea

public class PivotAreaFilterCollection : CollectionBase<PivotAreaFilter>

Constructors

NameDescription
PivotAreaFilterCollection()The default constructor.

Properties

NameDescription
Capacity { get; set; }
Count { get; }
Item { get; }Gets filter from the list by the index.
Item { get; set; }

Methods

NameDescription
BinarySearch(PivotAreaFilter)
BinarySearch(PivotAreaFilter, IComparer<PivotAreaFilter>)
BinarySearch(int, int, PivotAreaFilter, IComparer<PivotAreaFilter>)
Clear()
Contains(PivotAreaFilter)
CopyTo(PivotAreaFilter[])
CopyTo(PivotAreaFilter[], int)
CopyTo(int, PivotAreaFilter[], int, int)
Exists(Predicate<PivotAreaFilter>)
Find(Predicate<PivotAreaFilter>)
FindAll(Predicate<PivotAreaFilter>)
FindIndex(Predicate<PivotAreaFilter>)
FindIndex(int, Predicate<PivotAreaFilter>)
FindIndex(int, int, Predicate<PivotAreaFilter>)
FindLast(Predicate<PivotAreaFilter>)
FindLastIndex(Predicate<PivotAreaFilter>)
FindLastIndex(int, Predicate<PivotAreaFilter>)
FindLastIndex(int, int, Predicate<PivotAreaFilter>)
GetEnumerator()
IndexOf(PivotAreaFilter)
IndexOf(PivotAreaFilter, int)
IndexOf(PivotAreaFilter, int, int)
LastIndexOf(PivotAreaFilter)
LastIndexOf(PivotAreaFilter, int)
LastIndexOf(PivotAreaFilter, int, int)
RemoveAt(int)

Examples

namespace AsposeCellsExamples
{
    using Aspose.Cells;
    using Aspose.Cells.Pivot;
    using System;

    public class PivotClassPivotAreaFilterCollectionDemo
    {
        public static void Run()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Add sample data for pivot table
            var cells = worksheet.Cells;
            cells["A1"].Value = "Fruit";
            cells["B1"].Value = "Quantity";
            cells["A2"].Value = "Apple";
            cells["B2"].Value = 10;
            cells["A3"].Value = "Orange";
            cells["B3"].Value = 15;
            cells["A4"].Value = "Banana";
            cells["B4"].Value = 20;
            cells["A5"].Value = "Apple";
            cells["B5"].Value = 5;

            // Create pivot table
            int index = worksheet.PivotTables.Add("A1:B5", "C3", "PivotTable1");
            PivotTable pivotTable = worksheet.PivotTables[index];
            pivotTable.AddFieldToArea(PivotFieldType.Row, "Fruit");
            pivotTable.AddFieldToArea(PivotFieldType.Data, "Quantity");

            // Create PivotAreaFilterCollection
            PivotAreaFilterCollection filters = new PivotAreaFilterCollection();

            // Create and add filters (though the API reflection shows limited functionality)
            // Note: Actual filter creation would require more complete API information
            // This demonstrates the collection structure
            
            // Access items (read-only property)
            if (filters.Count > 0)
            {
                var firstFilter = filters[0];
            }

            // Save the workbook
            workbook.Save("PivotAreaFilterCollectionDemo.xlsx");
        }
    }
}

See Also