All docs
V19.2
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+
Row

CellRange.Style Property

Gets or sets the style applied to the current range of cells.

Namespace: DevExpress.Spreadsheet

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

Declaration

Style Style { get; set; }
Property Style As Style
Style Style { get; set; }
Property Style As Style
Style Style { get; set; }
Property Style As Style

Property Value

Type Description
Style

A Style object that specifies the cell style. If the range includes cells formatted in different styles, the Style property of this range object returns null (Nothing in VB).

Property Value

Type Description
Style

A Style object that specifies the cell style. If the range includes cells formatted in different styles, the Style property of this range object returns null (Nothing in VB).

Property Value

Type Description
Style

A Style object that specifies the cell style. If the range includes cells formatted in different styles, the Style property of this range object returns null (Nothing in VB).

Remarks

By default, the Normal style is applied to worksheet cells (such cells are considered as unformatted). However, you can apply any built-in or custom style from the IWorkbook.Styles collection to a cell or cell range by assigning the corresponding Style object to the Style property.

For more information on how you can change cell appearance, see the Formatting Cells and Conditional Formatting documents.

Examples

This example demonstrates how to format a cell, a range of cells, an entire row or an entire column by applying a style.

  1. Access the Style object that specifies the style to be applied to a cell or a range of cells. This style should be added to the IWorkbook.Styles collection.
  2. Assign the required style object to the CellRange.Style property of the cell, cell range, row or column object.
// Access the built-in "Good" MS Excel style from the Styles collection of the workbook.
Style styleGood = workbook.Styles[BuiltInStyleId.Good];

// Apply the "Good" style to a range of cells.
worksheet.Range["A1:C4"].Style = styleGood;

// Access a custom style that has been previously created in the loaded document by its name.
Style customStyle = workbook.Styles["Custom Style"];

// Apply the custom style to the cell.
worksheet.Cells["D6"].Style = customStyle;

// Apply the "Good" style to the eighth row.
worksheet.Rows[7].Style = styleGood;

// Apply the custom style to the "H" column.
worksheet.Columns["H"].Style = customStyle;
See Also