Class MultipleFilterCollection
MultipleFilterCollection class
Represents the multiple filter collection.
public class MultipleFilterCollection : CollectionBase
Constructors
Properties
| Name | Description |
|---|
| Item { get; } | DateTimeGroupItem or a simple object. |
| MatchBlank { get; set; } | Indicates whether to filter by blank. |
Methods
| Name | Description |
|---|
| Add(string) | Adds string filter. |
Examples
using System;
using Aspose.Cells;
namespace AsposeCellsExamples
{
public class CellsClassMultipleFilterCollectionDemo
{
public static void Run()
{
Workbook wb = new Workbook();
Worksheet sheet = wb.Worksheets[0];
Cells cells = sheet.Cells;
// Populate sample data
cells[0, 0].PutValue("Data");
cells[1, 0].PutValue("abc");
cells[2, 0].PutValue("def");
cells[3, 0].PutValue("ghi");
cells[4, 0].PutValue("abc");
cells[5, 0].PutValue("jkl");
cells[6, 0].PutValue("mno");
// Apply auto filter
sheet.AutoFilter.Range = "A1:A7";
FilterColumn fc = sheet.AutoFilter.FilterColumns[0];
fc.FilterType = FilterType.MultipleFilters;
// Create and configure multiple filter collection
MultipleFilterCollection mfc = new MultipleFilterCollection();
mfc.Add("abc");
mfc.Add("ghi");
mfc.MatchBlank = false;
fc.Filter = mfc;
// Apply filter
sheet.AutoFilter.Refresh();
// Display results
Console.WriteLine("Filter Results:");
for (int i = 1; i <= 6; i++)
{
Console.WriteLine($"Row {i}: {(cells.IsRowHidden(i) ? "Hidden" : "Visible")}");
}
}
}
}
See Also