MultipleFilterCollection.Add

Add(string)

Adds a label filter criteria.

public void Add(string filter)
ParameterTypeDescription
filterStringThe filter data.

Examples

using System;
using Aspose.Cells;

namespace AsposeCellsExamples
{
    public class MultipleFilterCollectionMethodAddWithStringDemo
    {
        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");
            
            // Apply filter
            sheet.AutoFilter.Range = "A1:A5";
            FilterColumn fc = sheet.AutoFilter.FilterColumns[0];
            fc.FilterType = FilterType.MultipleFilters;
            
            MultipleFilterCollection mfc = new MultipleFilterCollection();
            mfc.Add("abc");  // Demonstrate Add method with string parameter
            mfc.Add("ghi");
            
            fc.Filter = mfc;
            sheet.AutoFilter.Refresh();
            
            // Output filtered results
            Console.WriteLine("Filtered Rows:");
            for (int i = 1; i <= 4; i++)
            {
                if (!cells.IsRowHidden(i))
                {
                    Console.WriteLine(cells[i, 0].StringValue);
                }
            }
        }
    }
}

See Also


Add(DateTimeGroupingType, int, int, int)

Adds a date filter criteria value.

public void Add(DateTimeGroupingType type, int year, int month, int day)
ParameterTypeDescription
typeDateTimeGroupingTypeThe type of date filter.
yearInt32The year.
monthInt32The month.
dayInt32The day.

See Also


Add(DateTimeGroupingType, int, int, int, int, int, int)

Adds a date time filter criteria value.

public void Add(DateTimeGroupingType type, int year, int month, int day, int hour, int minute, 
    int second)
ParameterTypeDescription
typeDateTimeGroupingTypeThe type of date filter.
yearInt32The year.
monthInt32The month.
dayInt32The day.
hourInt32The hour.
minuteInt32The minute.
secondInt32The second.

See Also