XlFill.PatternType Property
Gets or sets the type of the pattern applied to a cell background.
Namespace: DevExpress.Export.Xl
Assembly: DevExpress.Printing.v24.2.Core.dll
Declaration
Property Value
Type | Description |
---|---|
XlPatternType | An XlPatternType enumeration member that is a preset type of pattern fill. |
Available values:
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. |
DarkGray | Specifies the 75% gray pattern. |
LightGray | Specifies the 25% gray pattern. |
DarkHorizontal | Specifies a pattern that is a series of thick horizontal stripes. |
DarkVertical | Specifies a pattern that is a series of thick vertical stripes. |
DarkDown | Specifies a pattern that is a series of thick downward diagonal stripes. |
DarkUp | Specifies a pattern that is a series of thick upward diagonal stripes. |
DarkGrid | Specifies the thick grid pattern. |
DarkTrellis | Specifies the thick diagonal trellis pattern. |
LightHorizontal | Specifies a pattern that is a series of thin horizontal stripes. |
LightVertical | Specifies a pattern that is a series of thin vertical stripes. |
LightDown | Specifies a pattern that is a series of thin downward diagonal stripes. |
LightUp | Specifies a pattern that is a series of thin upward diagonal stripes. |
LightGrid | Specifies the thin grid pattern. |
LightTrellis | Specifies the thin diagonal trellis pattern. |
Gray125 | Specifies the 12.5% gray pattern. |
Gray0625 | Specifies the 6.25% gray pattern. |
Remarks
Use the XlFill.PatternFill method to specify a pattern style for a cell. The XlFill.BackColor and XlFill.ForeColor properties allow you to control the background color and foreground color of the cell fill pattern.
By default, the PatternType property is set to XlPatternType.None. When you use the XlFill.SolidFill method to color the cell background, the PatternType property value is automatically changed to XlPatternType.Solid.
For more information on how to set the background characteristics of a cell, refer to the How to: Change Cell Background Color example.
Example
Note
A complete sample project is available at https://github.com/DevExpress-Examples/excel-export-api-examples
// Create a new worksheet.
using(IXlSheet sheet = document.CreateSheet()) {
using(IXlRow row = sheet.CreateRow()) {
using(IXlCell cell = row.CreateCell()) {
// Fill the cell background using the predefined color.
cell.ApplyFormatting(XlFill.SolidFill(Color.Beige));
}
using(IXlCell cell = row.CreateCell()) {
// Fill the cell background using the custom RGB color.
cell.ApplyFormatting(XlFill.SolidFill(Color.FromArgb(0xff, 0x99, 0x66)));
}
using(IXlCell cell = row.CreateCell()) {
// Fill the cell background using the theme color.
cell.ApplyFormatting(XlFill.SolidFill(XlColor.FromTheme(XlThemeColor.Accent3, 0.4)));
}
}
using(IXlRow row = sheet.CreateRow()) {
using(IXlCell cell = row.CreateCell()) {
// Specify the cell background pattern using predefined colors.
cell.ApplyFormatting(XlFill.PatternFill(XlPatternType.DarkDown, Color.Red, Color.White));
}
using(IXlCell cell = row.CreateCell()) {
// Specify the cell background pattern using custom RGB colors.
cell.ApplyFormatting(XlFill.PatternFill(XlPatternType.DarkTrellis, Color.FromArgb(0xff, 0xff, 0x66), Color.FromArgb(0x66, 0x99, 0xff)));
}
using(IXlCell cell = row.CreateCell()) {
// Specify the cell background pattern using theme colors.
cell.ApplyFormatting(XlFill.PatternFill(XlPatternType.LightHorizontal, XlColor.FromTheme(XlThemeColor.Accent1, 0.2), XlColor.FromTheme(XlThemeColor.Light2, 0.0)));
}
}
}