AutoFilter.MatchNonBlanks
AutoFilter.MatchNonBlanks method
Match all not blank cell in the list.
public void MatchNonBlanks(int fieldIndex)
| Parameter | Type | Description |
|---|---|---|
| fieldIndex | Int32 | The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0). |
Examples
using System;
using Aspose.Cells;
namespace AsposeCellsExamples
{
public class AutoFilterMethodMatchNonBlanksWithInt32Demo
{
public static void Run()
{
// Create a workbook with sample data
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
// Add sample data with some blank cells
worksheet.Cells["A1"].PutValue("Fruits");
worksheet.Cells["B1"].PutValue("Quantity");
worksheet.Cells["A2"].PutValue("Apple");
worksheet.Cells["B2"].PutValue(10);
worksheet.Cells["A3"].PutValue(""); // Blank cell
worksheet.Cells["B3"].PutValue(5);
worksheet.Cells["A4"].PutValue("Orange");
worksheet.Cells["B4"].PutValue(8);
worksheet.Cells["A5"].PutValue(""); // Blank cell
worksheet.Cells["B5"].PutValue(12);
// Apply auto filter to show only non-blank cells in column A (index 0)
worksheet.AutoFilter.Range = "A1:B5";
worksheet.AutoFilter.MatchNonBlanks(0);
worksheet.AutoFilter.Refresh();
// Save the workbook
workbook.Save("FilterNonBlanks.xlsx");
}
}
}
See Also
- class AutoFilter
- namespace Aspose.Cells
- assembly Aspose.Cells