Skip to main content
A newer version of this page is available. .
Row

StyleCollection.DefaultStyle Property

Returns the Normal style that is applied to cells by default.

Namespace: DevExpress.Spreadsheet

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

Declaration

Style DefaultStyle { get; }

Property Value

Type Description
Style

A Style object specifying the Normal style.

Remarks

Use the DefaultStyle property to access the Normal built-in style that is automatically included in the StyleCollection collection and applied to all unformatted cells in the workbook by default. This style can be also accessed from the StyleCollection collection by the style name (“Normal”) or index (0).

Example

This example demonstrates how to remove all formatting from a cell or range of cells. You can do this in one of the following ways.

  • Call the Worksheet.ClearFormats method with the passed object specifying the cell or cell range to be cleared.
  • Apply the Normal style to a cell or range of cells via the Range.Style property.

    The Normal style object can be accessed from the Workbook.Styles collection by the style name (Normal) or index (by default, this style is added as the first in the collection of styles and cannot be deleted), or via the StyleCollection.DefaultStyle property.

using DevExpress.Spreadsheet;
// ...

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

// Call the ClearFormats method.
worksheet.ClearFormats(worksheet.Range["A1:C4"]);

// Apply the Normal style to cells.
worksheet.Cells["D6"].Style = workbook.Styles[0];
worksheet.Range["F3:H4"].Style = workbook.Styles[BuiltInStyleId.Normal];
worksheet.Rows[7].Style = workbook.Styles["Normal"];
worksheet.Columns["K"].Style = workbook.Styles.DefaultStyle;
See Also