CustomFilterCollection.Item
CustomFilterCollection indexer
Gets the custom filter in the specific index.
public CustomFilter this[int index] { get; }
| Parameter | Description |
|---|---|
| index | The index. |
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using System;
public class CustomFilterCollectionPropertyItemDemo
{
public static void Run()
{
// Create a new workbook
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
// Add sample data
worksheet.Cells["A1"].Value = "Numbers";
worksheet.Cells["A2"].Value = 10;
worksheet.Cells["A3"].Value = 20;
worksheet.Cells["A4"].Value = 30;
worksheet.Cells["A5"].Value = 40;
worksheet.Cells["A6"].Value = 50;
try
{
// Create a new CustomFilterCollection
CustomFilterCollection filters = new CustomFilterCollection();
// Access the Item property (read-only) using indexer
// Since the collection is empty, we'll just demonstrate accessing the property
// In a real scenario, you would first add filters through other means
if (filters.Count > 0)
{
CustomFilter firstFilter = filters[0];
Console.WriteLine($"First filter operator: {firstFilter.FilterOperatorType}");
Console.WriteLine($"First filter criteria: {firstFilter.Criteria}");
}
else
{
Console.WriteLine("No filters in collection to demonstrate Item property");
}
// Save the workbook
workbook.Save("CustomFilterCollectionItemDemo.xlsx");
Console.WriteLine("CustomFilterCollection Item property demonstrated successfully");
}
catch (Exception ex)
{
Console.WriteLine($"Error demonstrating Item property: {ex.Message}");
}
}
}
}
See Also
- class CustomFilter
- class CustomFilterCollection
- namespace Aspose.Cells
- assembly Aspose.Cells