Skip to main content
A newer version of this page is available. .

XlDynamicFilter.Value Property

Gets or sets a dynamic filter value.

Namespace: DevExpress.Export.Xl

Assembly: DevExpress.Printing.v20.2.Core.dll

NuGet Packages: DevExpress.Printing.Core, DevExpress.WindowsDesktop.Printing.Core

Declaration

public XlVariantValue Value { get; set; }

Property Value

Type Description
XlVariantValue

An XlVariantValue object.

Remarks

If you use a dynamic filter of the XlDynamicFilterType.AboveAverage or XlDynamicFilterType.BelowAverage type, you should assign the arithmetic mean of values in the filtered column to the Value property to perform filtering, since an exporter cannot calculate this value automatically.

The Value property is also used along with XlDynamicFilter.MaxValue to define the minimum and maximum values for the dynamic filter types listed below. Note that you don’t need to specify these values manually in your code as they are set automatically to the appropriate values based on the current date and time.

Example

// Generate the header row.
using (IXlRow row = sheet.CreateRow())
    row.BulkCells(new string[] { "Region", "Product", "Sales" }, headerRowFormatting);

// Apply a dynamic filter to the "Sales" column to display only values that are above the average.
XlDynamicFilter filter = new XlDynamicFilter(XlDynamicFilterType.AboveAverage, 5045);
sheet.AutoFilterColumns.Add(new XlFilterColumn(2, 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