.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

Fill.BackgroundColor Property

Gets or sets the cell background color.

Namespace: DevExpress.Spreadsheet

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


Color BackgroundColor { get; set; }
Property BackgroundColor As Color

Property Value

Type Description

A Color value that specifies the cell background color.


To specify the background characteristics of a cell, use the BackgroundColor, Fill.FillType, Fill.Gradient, Fill.PatternType and Fill.PatternColor properties of the Fill object. Note that when you set the BackgroundColor property for a cell with no background (Fill.PatternType is set to PatternType.None), this cell background pattern type is automatically changed to PatternType.Solid.


If the BackgroundColor property is set to a non-empty value, gradient effects are not applicable.

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.


You can also set a background color for an individual cell or range of cells via the CellRange.FillColor property.

To specify the cell font color, use the SpreadsheetFont.Color property of the SpreadsheetFont object accessed via the Formatting.Font property. For details, review the How to: Change Cell Font and Background Color example.


The following example specifies font and background colors for an individual cell and cell range:

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;
See Also