New to Telerik Document ProcessingStart a free 30-day trial

Cell Styles

Updated on Jun 16, 2026

A cell style is a predefined set of formatting options, such as cell borders, fonts, font sizes, and number formats. Cell styles allow you to apply multiple format options in one step and also offer an easy approach to achieve consistency in cell formatting. When you update a style, all cells that have already applied this style update with the new value.

Cell Style Properties

A cell style is represented by the SpreadCellStyle class. The properties of the class can be categorized in five groups: number, alignment, font, border, and fill. The following list shows all properties distributed in their corresponding groups:

  • Number group

    • NumberFormat: Gets or sets the number format.
  • Alignment group

    • HorizontalAlignment: Gets or sets the horizontal alignment. The property is of type SpreadHorizontalAlignment.

    • VerticalAlignment: Gets or sets the vertical alignment. The property is of type SpreadVerticalAlignment.

    • Indent: Gets or sets the indent.

    • WrapText: Gets or sets a value indicating if the text in a cell is line-wrapped within the cell.

  • Font group

    • ForeColor: Gets or sets the fore color. The property is of type SpreadThemableColor.

    • FontFamily: Gets or sets the font family. The property is of type SpreadThemableFontFamily.

    • FontSize: Gets or sets the size of the font.

    • IsBold: Gets or sets a value indicating whether the text is bold.

    • IsItalic: Gets or sets a value indicating whether the text is italic.

    • Underline: Gets or sets the underline type. The property is of type SpreadUnderlineType.

  • Border group

    • LeftBorder: Gets or sets the left border. The property is of type SpreadBorder.

    • RightBorder: Gets or sets the right border. The property is of type SpreadBorder.

    • TopBorder: Gets or sets the top border. The property is of type SpreadBorder.

    • BottomBorder: Gets or sets the bottom border. The property is of type SpreadBorder.

    • DiagonalUpBorder: Gets or sets the diagonal up border. The property is of type SpreadBorder.

    • DiagonalDownBorder: Gets or sets the diagonal down border. The property is of type SpreadBorder.

  • Fill group

In addition to the previous properties, the SpreadCellStyle class exposes six Boolean properties that indicate whether the groups are applied:

  • ApplyNumberFormat
  • ApplyAlignment
  • ApplyFont
  • ApplyBorder
  • ApplyFill
  • ApplyProtection

When you apply a style to a cell with locally set properties, the result is an addition of the style properties to the cell local properties. The result of such an addition depends on which elements (groups) of the style you have selected as applied when using the particular style. You can select a group to be applied along with the style by setting the appropriate property to true.

Example 1 shows what applying the Number group looks like.

Example 1: Get a Built-In Style and Apply a Number Group

C#
SpreadCellStyle style = workbook.CellStyles.GetByName("Good");
style.ApplyNumberFormat = true;

Through the API you can add, modify, or remove styles from the CellStyles collection of IWorkbookExporter.

If you want to set a particular property of a cell, you can do it through the cell format.

Create a Style

To create a new style, invoke the Add() method of the workbook CellStyles collection. The method returns an object of type SpreadCellStyle, which you can manipulate.

Example 2: Create SpreadCellStyle and Apply It to a Cell

C#
SpreadBorder border = new SpreadBorder(SpreadBorderStyle.Thick, new SpreadThemableColor(new SpreadColor(255, 0, 0)));
			SpreadCellStyle style = workbook.CellStyles.Add("MyStyle");

			style.TopBorder = border;
			style.BottomBorder = border;
			style.DiagonalDownBorder = border;
			style.DiagonalUpBorder = border;
			style.LeftBorder = border;
			style.RightBorder = border;
			style.Fill = SpreadPatternFill.CreateSolidFill(new SpreadColor(255, 0, 0));
			style.FontFamily = new SpreadThemableFontFamily(SpreadThemeFontType.Major);
			style.FontSize = 22;
			style.ForeColor = new SpreadThemableColor(new SpreadColor(0, 255, 0));
			style.Underline = SpreadUnderlineType.DoubleAccounting;
			style.IsBold = true;
			style.IsItalic = true;
			style.HorizontalAlignment = SpreadHorizontalAlignment.Fill;
			style.Indent = 5;
			style.VerticalAlignment = SpreadVerticalAlignment.Top;
			style.WrapText = false;

			cell.SetFormat(new SpreadCellFormat()
			{
				CellStyle = style
			});

Modify a Style

To modify a style, retrieve it from the CellStyles collection and set the properties you need.

Example 3 obtains the Bad style from the cell styles collection of a workbook and modifies it.

Example 3: Modify a Built-In Style

C#
SpreadCellStyle style = workbook.CellStyles.GetByName("Bad");
			style.IsBold = true;

See Also