alexa
menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    Show / Hide Table of Contents

    Class CellFormat

    Represents the visual styling options for a spreadsheet cell, including colors, font properties, alignment, and text decorations.

    Inheritance
    object
    CellFormat
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Syncfusion.Blazor.Spreadsheet
    Assembly: Syncfusion.Blazor.Spreadsheet.dll
    Syntax
    public class CellFormat
    Remarks

    This class defines cell-level styling attributes that can be applied to individual cell or ranges in a spreadsheet using methods such as CellFormatAsync(CellFormat, string). All properties are optional and can be set independently to customize specific aspects of cell appearance.

    Color properties (BackgroundColor and Color) accept CSS-compatible color values:

    • Hexadecimal format: "#RRGGBB" (e.g., "#FFFFFF" for white, "#000000" for black)
    • Named colors: "red", "blue", "green", etc.
    • RGB format: "rgb(255, 255, 255)"

    Font size (FontSize) should include a unit specification such as "pt" (points) or "px" (pixels). Common values include "10pt", "12pt", "14pt", or "16px".

    All enum-based properties (FontStyle, FontWeight, TextAlign, TextDecoration, and VerticalAlign) use strongly typed enumerations to ensure consistency and prevent invalid values.

    Properties with nullable types (TextAlign, TextDecoration, VerticalAlign) default to null, meaning no change will be applied to those attributes if not explicitly set.

    Constructors

    CellFormat()

    Declaration
    public CellFormat()

    Properties

    BackgroundColor

    Gets or sets the background color of a cell.

    Declaration
    [JsonPropertyName("backgroundColor")]
    public string BackgroundColor { get; set; }
    Property Value
    Type Description
    string

    A string representing a CSS-compatible color value. Accepts hexadecimal format (e.g., "#FFFFFF"), named colors (e.g., "red"), or RGB format (e.g., "rgb(255, 255, 255)"). The default value is null, which leaves the background color unchanged.

    Color

    Gets or sets the text color of the cell content.

    Declaration
    [JsonPropertyName("color")]
    public string Color { get; set; }
    Property Value
    Type Description
    string

    A string representing a CSS-compatible color value. Accepts hexadecimal format (e.g., "#000000"), named colors (e.g., "blue"), or RGB format (e.g., "rgb(0, 0, 0)"). The default value is null, which leaves the text color unchanged.

    FontFamily

    Gets or sets the font family for the cell text.

    Declaration
    [JsonPropertyName("fontFamily")]
    public FontFamily? FontFamily { get; set; }
    Property Value
    Type Description
    FontFamily?

    A FontFamily enumeration value specifying the typeface to use. Common values include Arial, Calibri, TimesNewRoman, etc. The default value is null, which leaves the font family unchanged.

    Remarks

    When this property is modified along with FontSize, row height is automatically adjusted to accommodate the new font dimensions.

    FontSize

    Gets or sets the font size for the cell text.

    Declaration
    [JsonPropertyName("fontSize")]
    public string FontSize { get; set; }
    Property Value
    Type Description
    string

    A string specifying the font size with a unit suffix. Common values include "10pt", "12pt", "14pt" (points), or "12px", "16px" (pixels). The default value is null, which leaves the font size unchanged.

    Remarks

    When this property is modified along with FontFamily, row height is automatically adjusted to accommodate the new font dimensions.

    FontStyle

    Gets or sets the font style applied to the cell text.

    Declaration
    [JsonPropertyName("fontStyle")]
    public FontStyle FontStyle { get; set; }
    Property Value
    Type Description
    FontStyle

    A FontStyle enumeration value. Valid values include:

    • Normal - Regular text (default)
    • Italic - Italicized text

    FontWeight

    Gets or sets the font weight applied to the cell text.

    Declaration
    [JsonPropertyName("fontWeight")]
    public FontWeight FontWeight { get; set; }
    Property Value
    Type Description
    FontWeight

    A FontWeight enumeration value. Valid values include:

    • Normal - Regular weight (default)
    • Bold - Bold text

    TextAlign

    Gets or sets the horizontal alignment of the cell text.

    Declaration
    [JsonPropertyName("textAlign")]
    public TextAlign? TextAlign { get; set; }
    Property Value
    Type Description
    TextAlign?

    A nullable TextAlign enumeration value. Valid values include:

    • Left - Align text to the left edge
    • Center - Center text horizontally
    • Right - Align text to the right edge
    The default value is null, which leaves the horizontal alignment unchanged.

    TextDecoration

    Gets or sets the text decoration style for the cell text.

    Declaration
    [JsonPropertyName("textDecoration")]
    public TextDecoration? TextDecoration { get; set; }
    Property Value
    Type Description
    TextDecoration?

    A nullable TextDecoration enumeration value. Valid values include:

    • None - No decoration (default)
    • Underline - Underlined text
    • LineThrough - Strikethrough text
    The default value is null, which leaves the text decoration unchanged.

    VerticalAlign

    Gets or sets the vertical alignment of the cell content.

    Declaration
    [JsonPropertyName("verticalAlign")]
    public VerticalAlign? VerticalAlign { get; set; }
    Property Value
    Type Description
    VerticalAlign?

    A nullable VerticalAlign enumeration value. Valid values include:

    • Top - Align content to the top of the cell
    • Middle - Center content vertically
    • Bottom - Align content to the bottom of the cell
    The default value is null, which leaves the vertical alignment unchanged.
    In this article
    Back to top Generated by DocFX
    Copyright © 2001 - 2026 Syncfusion Inc. All Rights Reserved