officefileapi-devexpress-dot-spreadsheet-dot-fill-2d8d2966.md
Gets or sets the cell background pattern.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
PatternType PatternType { get; set; }
Property PatternType As PatternType
| Type | Description |
|---|---|
| PatternType |
A PatternType enumeration member that specifies the pattern for the cell shading. Default is None.
|
Available values:
Show 19 items
| Name | Description | Example |
|---|---|---|
| None |
No background (solid color or fill pattern) is applied to a cell.
| | | Solid |
Specifies that a cell is filled with a solid Fill.BackgroundColor 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.
|
|
To specify the cell background characteristics, use the Fill.BackgroundColor, PatternType and Fill.PatternColor properties of the Fill object.
By default, the PatternType property is set to PatternType.None. When you set the Fill.BackgroundColor property, the PatternType property value is automatically changed to PatternType.Solid.
To access the Fill object, use the Formatting.Fill property.
For examples on how to specify formatting for an individual cell and cell range or modify a style, refer to the How to: Format a Cell or Range of Cells or How to: Create or Modify a Style document.
The following example specifies font and background colors for an individual cell and cell range:
View Example: Spreadsheet Document API Examples
using DevExpress.Spreadsheet;
using System.Drawing;
// ...
// Format an individual cell.
worksheet.Cells["A1"].Font.Color = Color.Red;
worksheet.Cells["A1"].FillColor = Color.Yellow;
// Format a cell range.
CellRange range = worksheet.Range["C3:D4"];
Formatting rangeFormatting = range.BeginUpdateFormatting();
rangeFormatting.Font.Color = Color.Blue;
rangeFormatting.Fill.BackgroundColor = Color.LightBlue;
rangeFormatting.Fill.PatternType = PatternType.LightHorizontal;
rangeFormatting.Fill.PatternColor = Color.Violet;
range.EndUpdateFormatting(rangeFormatting);
Imports DevExpress.Spreadsheet
Imports System.Drawing
' ...
' Format an individual cell.
worksheet.Cells("A1").Font.Color = Color.Red
worksheet.Cells("A1").FillColor = Color.Yellow
' Format a cell range.
Dim range As CellRange = worksheet.Range("C3:D4")
Dim rangeFormatting As Formatting = range.BeginUpdateFormatting()
rangeFormatting.Font.Color = Color.Blue
rangeFormatting.Fill.BackgroundColor = Color.LightBlue
rangeFormatting.Fill.PatternType = PatternType.LightHorizontal
rangeFormatting.Fill.PatternColor = Color.Violet
range.EndUpdateFormatting(rangeFormatting)
The following code snippets (auto-collected from DevExpress Examples) contain references to the PatternType property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
rangeFormatting.Fill.BackgroundColor = Color.LightBlue;
rangeFormatting.Fill.PatternType = PatternType.LightHorizontal;
rangeFormatting.Fill.PatternColor = Color.Violet;
rangeFormatting.Fill.BackgroundColor = Color.LightBlue;
rangeFormatting.Fill.PatternType = PatternType.LightHorizontal;
rangeFormatting.Fill.PatternColor = Color.Violet;
myStyle.Fill.BackgroundColor = Color.LightBlue
myStyle.Fill.PatternType = PatternType.LightGray
myStyle.Fill.PatternColor = Color.Yellow
rangeFormatting.Fill.BackgroundColor = Color.LightBlue
rangeFormatting.Fill.PatternType = PatternType.LightHorizontal
rangeFormatting.Fill.PatternColor = Color.Violet
See Also