Format Class

Represents a format that can be applied to cells in a spreadsheet.

Inheritance

Object

Documents.Spreadsheet.Format

Namespace: Radzen.Documents.Spreadsheet

Assembly: Radzen.Blazor.dll

Syntax

public class Format

Constructors

FormatLink to this section

Represents a format that can be applied to cells in a spreadsheet.

Declaration
public Format()

Properties

BackgroundColorLink to this section

Gets or sets the background color of the format.

Declaration
public string BackgroundColor { get; set; }
Property Value
Type Description
stringGets or sets the background color of the format.

BoldLink to this section

Gets or sets whether the text in the format should be bold.

Declaration
public bool Bold { get; set; }
Property Value
Type Description
boolGets or sets whether the text in the format should be bold.

BorderBottomLink to this section

Gets or sets the bottom border style.

Declaration
public Documents.Spreadsheet.BorderStyle BorderBottom { get; set; }
Property Value
Type Description
Documents.Spreadsheet.BorderStyleGets or sets the bottom border style.

BorderLeftLink to this section

Gets or sets the left border style.

Declaration
public Documents.Spreadsheet.BorderStyle BorderLeft { get; set; }
Property Value
Type Description
Documents.Spreadsheet.BorderStyleGets or sets the left border style.

BorderRightLink to this section

Gets or sets the right border style.

Declaration
public Documents.Spreadsheet.BorderStyle BorderRight { get; set; }
Property Value
Type Description
Documents.Spreadsheet.BorderStyleGets or sets the right border style.

BorderTopLink to this section

Gets or sets the top border style.

Declaration
public Documents.Spreadsheet.BorderStyle BorderTop { get; set; }
Property Value
Type Description
Documents.Spreadsheet.BorderStyleGets or sets the top border style.

ColorLink to this section

Gets or sets the color of the text in the format.

Declaration
public string Color { get; set; }
Property Value
Type Description
stringGets or sets the color of the text in the format.

FontFamilyLink to this section

Gets or sets the font family.

Declaration
public string FontFamily { get; set; }
Property Value
Type Description
stringGets or sets the font family.

FontSizeLink to this section

Gets or sets the font size in points.

Declaration
public double? FontSize { get; set; }
Property Value
Type Description
double?Gets or sets the font size in points.

FormulaHiddenLink to this section

Gets or sets whether the cell's formula is hidden in the formula bar when sheet protection is active. Null means use the default (not hidden). Only takes effect when sheet protection is enabled.

Declaration
public bool? FormulaHidden { get; set; }
Property Value
Type Description
bool?Gets or sets whether the cell's formula is hidden in the formula bar when sheet protection is active. Null means use the default (not hidden). Only takes effect when sheet protection is enabled.

IsDefaultLink to this section

Gets a value indicating whether all format properties are at their default values.

Declaration
public bool IsDefault { get; }
Property Value
Type Description
boolGets a value indicating whether all format properties are at their default values.

IsFormulaHiddenLink to this section

Gets the effective formula hidden state (false if FormulaHidden is null).

Declaration
public bool IsFormulaHidden { get; }
Property Value
Type Description
boolGets the effective formula hidden state (false if FormulaHidden is null).

IsLockedLink to this section

Gets the effective locked state (true if Locked is null, since XLSX defaults to locked).

Declaration
public bool IsLocked { get; }
Property Value
Type Description
boolGets the effective locked state (true if Locked is null, since XLSX defaults to locked).

ItalicLink to this section

Gets or sets whether the text in the format should be italicized.

Declaration
public bool Italic { get; set; }
Property Value
Type Description
boolGets or sets whether the text in the format should be italicized.

LockedLink to this section

Gets or sets whether the cell is locked when sheet protection is active. Null means use the default (locked). Only takes effect when sheet protection is enabled.

Declaration
public bool? Locked { get; set; }
Property Value
Type Description
bool?Gets or sets whether the cell is locked when sheet protection is active. Null means use the default (locked). Only takes effect when sheet protection is enabled.

NumberFormatLink to this section

Gets or sets the number format code (e.g. "#,##0.00", "0%", "yyyy-mm-dd").

Declaration
public string NumberFormat { get; set; }
Property Value
Type Description
stringGets or sets the number format code (e.g. "#,##0.00", "0%", "yyyy-mm-dd").

StrikethroughLink to this section

Gets or sets whether the text in the format should have a strikethrough.

Declaration
public bool Strikethrough { get; set; }
Property Value
Type Description
boolGets or sets whether the text in the format should have a strikethrough.

TextAlignLink to this section

Gets or sets the text alignment in the format. Null means unset (default left).

Declaration
public TextAlign? TextAlign { get; set; }
Property Value
Type Description
TextAlign?Gets or sets the text alignment in the format. Null means unset (default left).

UnderlineLink to this section

Gets or sets whether the text in the format should be underlined.

Declaration
public bool Underline { get; set; }
Property Value
Type Description
boolGets or sets whether the text in the format should be underlined.

VerticalAlignLink to this section

Gets or sets the vertical alignment in the format. Null means unset (default top).

Declaration
public VerticalAlign? VerticalAlign { get; set; }
Property Value
Type Description
VerticalAlign?Gets or sets the vertical alignment in the format. Null means unset (default top).

WrapTextLink to this section

Gets or sets whether text should wrap within the cell.

Declaration
public bool WrapText { get; set; }
Property Value
Type Description
boolGets or sets whether text should wrap within the cell.

Methods

CloneLink to this section

Creates a new instance of the Format class that is a copy of the current instance.

Declaration
public Documents.Spreadsheet.Format Clone()
Returns

WithBackgroundColorLink to this section

This method is used to create a copy of the current format with a new background color.

Declaration
public Documents.Spreadsheet.Format WithBackgroundColor(string backgroundColor)
Parameters
Type Name Description
string backgroundColor
Returns

WithBoldLink to this section

This method is used to create a copy of the current format with a new bold setting.

Declaration
public Documents.Spreadsheet.Format WithBold(bool bold)
Parameters
Type Name Description
bool bold
Returns

WithBordersLink to this section

This method is used to create a copy of the current format with new border styles.

Declaration
public Documents.Spreadsheet.Format WithBorders(Documents.Spreadsheet.BorderStyle top, Documents.Spreadsheet.BorderStyle right, Documents.Spreadsheet.BorderStyle bottom, Documents.Spreadsheet.BorderStyle left)
Parameters
Returns

WithColorLink to this section

This method is used to create a copy of the current format with a new color.

Declaration
public Documents.Spreadsheet.Format WithColor(string color)
Parameters
Type Name Description
string color
Returns

WithFontFamilyLink to this section

This method is used to create a copy of the current format with a new font family.

Declaration
public Documents.Spreadsheet.Format WithFontFamily(string fontFamily)
Parameters
Type Name Description
string fontFamily
Returns

WithFontSizeLink to this section

This method is used to create a copy of the current format with a new font size.

Declaration
public Documents.Spreadsheet.Format WithFontSize(double? fontSize)
Parameters
Type Name Description
double? fontSize
Returns

WithFormulaHiddenLink to this section

Creates a copy of the current format with a new formula hidden setting.

Declaration
public Documents.Spreadsheet.Format WithFormulaHidden(bool? formulaHidden)
Parameters
Type Name Description
bool? formulaHidden
Returns

WithItalicLink to this section

This method is used to create a copy of the current format with a new italic setting.

Declaration
public Documents.Spreadsheet.Format WithItalic(bool italic)
Parameters
Type Name Description
bool italic
Returns

WithLockedLink to this section

Creates a copy of the current format with a new locked setting.

Declaration
public Documents.Spreadsheet.Format WithLocked(bool? locked)
Parameters
Type Name Description
bool? locked
Returns

WithNumberFormatLink to this section

This method is used to create a copy of the current format with a new number format code.

Declaration
public Documents.Spreadsheet.Format WithNumberFormat(string numberFormat)
Parameters
Type Name Description
string numberFormat
Returns

WithStrikethroughLink to this section

This method is used to create a copy of the current format with a new strikethrough setting.

Declaration
public Documents.Spreadsheet.Format WithStrikethrough(bool strikethrough)
Parameters
Type Name Description
bool strikethrough
Returns

WithTextAlignLink to this section

This method is used to create a copy of the current format with a new text alignment setting.

Declaration
public Documents.Spreadsheet.Format WithTextAlign(TextAlign? textAlign)
Parameters
Type Name Description
TextAlign? textAlign
Returns

WithUnderlineLink to this section

This method is used to create a copy of the current format with a new underline setting.

Declaration
public Documents.Spreadsheet.Format WithUnderline(bool underline)
Parameters
Type Name Description
bool underline
Returns

WithVerticalAlignLink to this section

This method is used to create a copy of the current format with a new vertical alignment setting.

Declaration
public Documents.Spreadsheet.Format WithVerticalAlign(VerticalAlign? verticalAlign)
Parameters
Type Name Description
VerticalAlign? verticalAlign
Returns

WithWrapTextLink to this section

This method is used to create a copy of the current format with a new wrap text setting.

Declaration
public Documents.Spreadsheet.Format WithWrapText(bool wrapText)
Parameters
Type Name Description
bool wrapText
Returns
An error has occurred. This app may no longer respond until reloaded. Reload 🗙