The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+
Row

Workbook.Styles Property

Provides access to the workbook's collection of cell styles.

You require a license to the DevExpress Office File API or DevExpress Universal Subscription to use this property in production code.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Docs.v19.2.dll

Declaration

public StyleCollection Styles { get; }
Public ReadOnly Property Styles As StyleCollection
public StyleCollection Styles { get; }
Public ReadOnly Property Styles As StyleCollection
public StyleCollection Styles { get; }
Public ReadOnly Property Styles As StyleCollection

Property Value

Type Description
StyleCollection

A StyleCollection collection containing cell styles.

Property Value

Type Description
StyleCollection

A StyleCollection collection containing cell styles.

Property Value

Type Description
StyleCollection

A StyleCollection collection containing cell styles.

Remarks

The StyleCollection contains Microsoft® Excel® built-in styles, including the Normal style that is applied to cells by default (StyleCollection.DefaultStyle). You can create custom styles, and copy, modify or delete existing styles (see the How to: Create or Modify a Style example).

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 Workbook.Styles collection.
  2. Assign the required style object to the CellRange.Style property of the cell, cell range, row or column object.
Worksheet worksheet = workbook.Worksheets[0];

// 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