Class CellFormat
Represents the visual styling options for a spreadsheet cell, including colors, font properties, alignment, and text decorations.
Inherited Members
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., |
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., |
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 |
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 |
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: |
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: |
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:
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:
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:
null, which leaves the vertical alignment unchanged.
|