Skip to main content

XlColorFilter.PatternType Property

Gets or sets the type of the pattern used in the filter criteria.

Namespace: DevExpress.Export.Xl

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

NuGet Package: DevExpress.Printing.Core

Declaration

public XlPatternType PatternType { get; set; }

Property Value

Type Description
XlPatternType

An XlPatternType enumeration member that specifies the type of the pattern fill used as a filter criterion.

Available values:

Show 19 items
Name Description
None

No background (solid color or fill pattern) is applied to a cell.

Solid

Specifies that a cell is filled with a solid color.

MediumGray

Specifies the 50% gray pattern.

PatternType_MediumGray

DarkGray

Specifies the 75% gray pattern.

PatternType_DarkGray

LightGray

Specifies the 25% gray pattern.

PatternType_LightGray

DarkHorizontal

Specifies a pattern that is a series of thick horizontal stripes.

PatternType_DarkHorizontal

DarkVertical

Specifies a pattern that is a series of thick vertical stripes.

PatternType_DarkVertical

DarkDown

Specifies a pattern that is a series of thick downward diagonal stripes.

PatternType_DarkDown

DarkUp

Specifies a pattern that is a series of thick upward diagonal stripes.

PatternType_DarkUp

DarkGrid

Specifies the thick grid pattern.

PatternType_DarkGrid

DarkTrellis

Specifies the thick diagonal trellis pattern.

PatternType_DarkTrellis

LightHorizontal

Specifies a pattern that is a series of thin horizontal stripes.

PatternType_LightHorizontal

LightVertical

Specifies a pattern that is a series of thin vertical stripes.

PatternType_LightVertical

LightDown

Specifies a pattern that is a series of thin downward diagonal stripes.

PatternType_LightDown

LightUp

Specifies a pattern that is a series of thin upward diagonal stripes.

PatternType_LightUp

LightGrid

Specifies the thin grid pattern.

PatternType_LightGrid

LightTrellis

Specifies the thin diagonal trellis pattern.

PatternType_LightTrellis

Gray125

Specifies the 12.5% gray pattern.

PatternType_Gray125

Gray0625

Specifies the 6.25% gray pattern.

PatternType_Gray0625

Remarks

To filter a column by a pattern fill applied to its cells, specify the following properties of the pattern style you wish to use as a filter criterion:

In addition, you should set the XlColorFilter.FilterByCellColor property to true to specify that the column is filtered by a cell fill, not a font color.

The following example demonstrates how to use a color filter to display cells to which a pattern fill is applied.

// 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 the specified pattern fill. 
XlColorFilter filter = new XlColorFilter();
filter.Color = XlColor.FromArgb(0x00ffcc99);
filter.FilterByCellColor = true;
filter.PatternColor = XlColor.FromArgb(0x00ff0000);
filter.PatternType = XlPatternType.LightDown;
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);
            if (i % 4 == 0)
                cell.ApplyFormatting(XlFill.PatternFill(XlPatternType.LightDown, XlColor.FromArgb(0x00ffcc99), XlColor.FromArgb(0x00ff0000)));
        }
        using (IXlCell cell = row.CreateCell())
        {
            cell.Value = amount[i];
            cell.ApplyFormatting(rowFormatting);
        }
    }
}

// Finish filtering.
sheet.EndFiltering();

The following image shows the result of the above-mentioned code’s execution (the workbook is opened in Microsoft® Excel®).

XlExport_Examples_FilterByPatternFill

See Also