XlValuesFilter.Values Property
In This Article
Provides access to the collection of cell values to filter by.
Namespace: DevExpress.Export.Xl
Assembly: DevExpress.Printing.v24.2.Core.dll
NuGet Package: DevExpress.Printing.Core
#Declaration
#Property Value
Type | Description |
---|---|
IList<String> | A collection of values to be used in a filter. |
#Remarks
Use the Add method of the Values collection to specify cell values that should be included in the filtering results.
You can include blank cells in a filter by setting the XlValuesFilter.FilterByBlank property to true.
To filter date and time values in a column, use the XlValuesFilter.DateGroups property.
#Example
Note
A complete sample project is available at https://github.
// Generate the header row.
using (IXlRow row = sheet.CreateRow())
row.BulkCells(new string[] { "Region", "Product", "Sales" }, headerRowFormatting);
// Start filtering data in the "Product" column by a list of values.
XlValuesFilter filter = new XlValuesFilter();
filter.Values.Add("Mascarpone Fabioli");
filter.Values.Add("Mozzarella di Giovanni");
sheet.AutoFilterColumns.Add(new XlFilterColumn(1, filter));
sheet.BeginFiltering(sheet.DataRange);
// Generate data for the document.
string[] products = new string[] { "Camembert Pierrot", "Gorgonzola Telino", "Mascarpone Fabioli", "Mozzarella di Giovanni" };
int[] amount = new int[] { 6750, 4500, 3550, 4250, 5500, 6250, 5325, 4235 };
for (int i = 0; i < 8; i++)
{
using (IXlRow row = sheet.CreateRow())
{
using (IXlCell cell = row.CreateCell())
{
cell.Value = (i < 4) ? "East" : "West";
cell.ApplyFormatting(rowFormatting);
}
using (IXlCell cell = row.CreateCell())
{
cell.Value = products[i % 4];
cell.ApplyFormatting(rowFormatting);
}
using (IXlCell cell = row.CreateCell())
{
cell.Value = amount[i];
cell.ApplyFormatting(rowFormatting);
}
}
}
// Finish filtering.
sheet.EndFiltering();
See Also