Class IconFilter
Contents
[
Hide
]IconFilter class
Represents icon filter.
public class IconFilter
Properties
| Name | Description |
|---|---|
| IconId { get; set; } | Gets and sets Zero-based index of an icon in an icon set. |
| IconSetType { get; set; } | Gets and sets which icon set is used for this filter criteria. |
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using System;
public class CellsClassIconFilterDemo
{
public static void Run()
{
// Create a new workbook for demonstration
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
try
{
// Populate sample data
for (int i = 0; i < 10; i++)
{
worksheet.Cells[i, 0].PutValue(i * 10);
}
// Create auto filter
worksheet.AutoFilter.Range = "A1:A10";
FilterColumn filterColumn = worksheet.AutoFilter.FilterColumns[0];
filterColumn.FilterType = FilterType.IconFilter;
// Get the icon filter
IconFilter iconFilter = (IconFilter)filterColumn.Filter;
// Set icon filter properties
iconFilter.IconSetType = IconSetType.Arrows3;
iconFilter.IconId = 1; // Filter for middle arrow
Console.WriteLine($"IconFilter created with IconSetType: {iconFilter.IconSetType} and IconId: {iconFilter.IconId}");
// Save the workbook
workbook.Save("IconFilterDemo.xlsx");
Console.WriteLine("Workbook saved successfully with icon filter applied.");
}
catch (Exception ex)
{
Console.WriteLine($"Error working with IconFilter: {ex.Message}");
}
}
}
}
See Also
- namespace Aspose.Cells
- assembly Aspose.Cells