GemBox.Spreadsheet
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    ExcelFont Class

    Namespace:
    GemBox.Spreadsheet
    Assembly:
    GemBox.Spreadsheet.dll

    Represents a typeface (for example, Calibri), along with its attributes (size, font style, underlining, color, and effects).

    • C#
    • VB.NET
    public sealed class ExcelFont
    Public NotInheritable Class ExcelFont
    Inheritance:
    System.Object
    ExcelFont
    Remarks

    Conceptually, cell formatting is divided into following groups:

    • Number - indicates how to format and render the numeric value of a cell. Associated property is NumberFormat.
    • Alignment - formatting information pertaining to text alignment in cells. Associated properties are HorizontalAlignment, VerticalAlignment, Indent, Rotation, IsTextVertical, WrapText and ShrinkToFit.
    • Font - defines the properties for the used font. Associated property is Font.
    • Border - expresses a single set of cell border formats (left, right, top, bottom and diagonal). Associated property is Borders.
    • Fill - specifies fill formatting (pattern or gradient). Associated property is FillPattern.
    • Protection - contains protection properties associated with the cell. Associated properties are Locked and FormulaHidden.

    Additional CellStyle properties not associated with any formatting group are:

    • Name - name of the referenced Style.
    • QuotePrefix - true to store numeric value of a cell as text; otherwise, false.
    • IsDefault - true if Name Style is default (Normal) and there are no additional modifications of cell formatting; otherwise, false.

    ExcelFile contains a set of Styles which can be referenced by multiple cells.

    ExcelFile must always contain at least one Style which cannot be removed and is, by default, referenced by all cells. This default style is Normal.

    Style can either be built-in or user-defined. Built-in style is accessible from Styles via BuiltInCellStyleName enumeration.

    Cell formatting group (Number, Alignment, Font, Border, Fill or Protection) (and its associated properties) is resolved from Name Style, unless cell formatting group or its associated property is modified.

    Cell formatting is available for one or more cells through Style property which is available on ExcelCell and CellRange types. Cell formatting specified on ExcelColumn and ExcelRow types through Style property is simply propagated to cell formatting of its Cells.

    note

    For performance reasons, cell formatting on CellRange is resolved based just on its top-left cell formatting, except borders which are resolved based on corner cells depending on border side.

    Setting cell formatting property on CellRange is propagated to each cell in a range.

    To set Style to one or more cells, simply assign it to Style property.

    tip

    Preferable way to modify formatting property of multiple cells is to get CellRange to which all those cells belong, and use Style property of that range to make the modification.

    If modifying multiple formatting properties of a CellRange, without preserving unmodified formatting properties, preferable way is to create new instance of CellStyle, make modifications on it, and assign it to Style property of that range.

    GemBox.Spreadsheet internally takes care not to allocate unnecessary cells when formatting a range of cells (for example, when formatting Cells) and to cache formatting information of equally formatted cells, at the appropriate time, to reduce memory footprint.

    Constructors

    ExcelFont()

    Initializes a new instance of the ExcelFont class.

    • C#
    • VB.NET
    public ExcelFont()
    Public Sub New

    Fields

    BoldWeight

    Default bold font weight.

    • C#
    • VB.NET
    public const int BoldWeight = 700
    Public Const BoldWeight As Integer = 700
    Field Value
    System.Int32
    See Also
    Weight

    MaxWeight

    Maximum font weight.

    • C#
    • VB.NET
    public const int MaxWeight = 1000
    Public Const MaxWeight As Integer = 1000
    Field Value
    System.Int32
    See Also
    Weight

    MinWeight

    Minimum font weight.

    • C#
    • VB.NET
    public const int MinWeight = 100
    Public Const MinWeight As Integer = 100
    Field Value
    System.Int32
    See Also
    Weight

    NormalWeight

    Normal font weight.

    • C#
    • VB.NET
    public const int NormalWeight = 400
    Public Const NormalWeight As Integer = 400
    Field Value
    System.Int32
    See Also
    Weight

    Properties

    Color

    Gets or sets the color of the text.

    Default value is color created from name Text1.

    • C#
    • VB.NET
    public SpreadsheetColor Color { get; set; }
    Public Property Color As SpreadsheetColor
    Property Value
    SpreadsheetColor

    The color of the text.

    Remarks

    Conceptually, cell formatting is divided into following groups:

    • Number - indicates how to format and render the numeric value of a cell. Associated property is NumberFormat.
    • Alignment - formatting information pertaining to text alignment in cells. Associated properties are HorizontalAlignment, VerticalAlignment, Indent, Rotation, IsTextVertical, WrapText and ShrinkToFit.
    • Font - defines the properties for the used font. Associated property is Font.
    • Border - expresses a single set of cell border formats (left, right, top, bottom and diagonal). Associated property is Borders.
    • Fill - specifies fill formatting (pattern or gradient). Associated property is FillPattern.
    • Protection - contains protection properties associated with the cell. Associated properties are Locked and FormulaHidden.

    Additional CellStyle properties not associated with any formatting group are:

    • Name - name of the referenced Style.
    • QuotePrefix - true to store numeric value of a cell as text; otherwise, false.
    • IsDefault - true if Name Style is default (Normal) and there are no additional modifications of cell formatting; otherwise, false.

    ExcelFile contains a set of Styles which can be referenced by multiple cells.

    ExcelFile must always contain at least one Style which cannot be removed and is, by default, referenced by all cells. This default style is Normal.

    Style can either be built-in or user-defined. Built-in style is accessible from Styles via BuiltInCellStyleName enumeration.

    Cell formatting group (Number, Alignment, Font, Border, Fill or Protection) (and its associated properties) is resolved from Name Style, unless cell formatting group or its associated property is modified.

    Cell formatting is available for one or more cells through Style property which is available on ExcelCell and CellRange types. Cell formatting specified on ExcelColumn and ExcelRow types through Style property is simply propagated to cell formatting of its Cells.

    note

    For performance reasons, cell formatting on CellRange is resolved based just on its top-left cell formatting, except borders which are resolved based on corner cells depending on border side.

    Setting cell formatting property on CellRange is propagated to each cell in a range.

    To set Style to one or more cells, simply assign it to Style property.

    tip

    Preferable way to modify formatting property of multiple cells is to get CellRange to which all those cells belong, and use Style property of that range to make the modification.

    If modifying multiple formatting properties of a CellRange, without preserving unmodified formatting properties, preferable way is to create new instance of CellStyle, make modifications on it, and assign it to Style property of that range.

    GemBox.Spreadsheet internally takes care not to allocate unnecessary cells when formatting a range of cells (for example, when formatting Cells) and to cache formatting information of equally formatted cells, at the appropriate time, to reduce memory footprint.

    Italic

    Gets or sets a value indicating whether to display characters in italic font style.

    Default value is false.

    • C#
    • VB.NET
    public bool Italic { get; set; }
    Public Property Italic As Boolean
    Property Value
    System.Boolean

    true to display characters in italic font style; otherwise, false.

    Remarks

    Conceptually, cell formatting is divided into following groups:

    • Number - indicates how to format and render the numeric value of a cell. Associated property is NumberFormat.
    • Alignment - formatting information pertaining to text alignment in cells. Associated properties are HorizontalAlignment, VerticalAlignment, Indent, Rotation, IsTextVertical, WrapText and ShrinkToFit.
    • Font - defines the properties for the used font. Associated property is Font.
    • Border - expresses a single set of cell border formats (left, right, top, bottom and diagonal). Associated property is Borders.
    • Fill - specifies fill formatting (pattern or gradient). Associated property is FillPattern.
    • Protection - contains protection properties associated with the cell. Associated properties are Locked and FormulaHidden.

    Additional CellStyle properties not associated with any formatting group are:

    • Name - name of the referenced Style.
    • QuotePrefix - true to store numeric value of a cell as text; otherwise, false.
    • IsDefault - true if Name Style is default (Normal) and there are no additional modifications of cell formatting; otherwise, false.

    ExcelFile contains a set of Styles which can be referenced by multiple cells.

    ExcelFile must always contain at least one Style which cannot be removed and is, by default, referenced by all cells. This default style is Normal.

    Style can either be built-in or user-defined. Built-in style is accessible from Styles via BuiltInCellStyleName enumeration.

    Cell formatting group (Number, Alignment, Font, Border, Fill or Protection) (and its associated properties) is resolved from Name Style, unless cell formatting group or its associated property is modified.

    Cell formatting is available for one or more cells through Style property which is available on ExcelCell and CellRange types. Cell formatting specified on ExcelColumn and ExcelRow types through Style property is simply propagated to cell formatting of its Cells.

    note

    For performance reasons, cell formatting on CellRange is resolved based just on its top-left cell formatting, except borders which are resolved based on corner cells depending on border side.

    Setting cell formatting property on CellRange is propagated to each cell in a range.

    To set Style to one or more cells, simply assign it to Style property.

    tip

    Preferable way to modify formatting property of multiple cells is to get CellRange to which all those cells belong, and use Style property of that range to make the modification.

    If modifying multiple formatting properties of a CellRange, without preserving unmodified formatting properties, preferable way is to create new instance of CellStyle, make modifications on it, and assign it to Style property of that range.

    GemBox.Spreadsheet internally takes care not to allocate unnecessary cells when formatting a range of cells (for example, when formatting Cells) and to cache formatting information of equally formatted cells, at the appropriate time, to reduce memory footprint.

    Name

    Gets or sets the face name of this font.

    Default value is Calibri.

    • C#
    • VB.NET
    public string Name { get; set; }
    Public Property Name As String
    Property Value
    System.String

    The face name of this font.

    Remarks

    Conceptually, cell formatting is divided into following groups:

    • Number - indicates how to format and render the numeric value of a cell. Associated property is NumberFormat.
    • Alignment - formatting information pertaining to text alignment in cells. Associated properties are HorizontalAlignment, VerticalAlignment, Indent, Rotation, IsTextVertical, WrapText and ShrinkToFit.
    • Font - defines the properties for the used font. Associated property is Font.
    • Border - expresses a single set of cell border formats (left, right, top, bottom and diagonal). Associated property is Borders.
    • Fill - specifies fill formatting (pattern or gradient). Associated property is FillPattern.
    • Protection - contains protection properties associated with the cell. Associated properties are Locked and FormulaHidden.

    Additional CellStyle properties not associated with any formatting group are:

    • Name - name of the referenced Style.
    • QuotePrefix - true to store numeric value of a cell as text; otherwise, false.
    • IsDefault - true if Name Style is default (Normal) and there are no additional modifications of cell formatting; otherwise, false.

    ExcelFile contains a set of Styles which can be referenced by multiple cells.

    ExcelFile must always contain at least one Style which cannot be removed and is, by default, referenced by all cells. This default style is Normal.

    Style can either be built-in or user-defined. Built-in style is accessible from Styles via BuiltInCellStyleName enumeration.

    Cell formatting group (Number, Alignment, Font, Border, Fill or Protection) (and its associated properties) is resolved from Name Style, unless cell formatting group or its associated property is modified.

    Cell formatting is available for one or more cells through Style property which is available on ExcelCell and CellRange types. Cell formatting specified on ExcelColumn and ExcelRow types through Style property is simply propagated to cell formatting of its Cells.

    note

    For performance reasons, cell formatting on CellRange is resolved based just on its top-left cell formatting, except borders which are resolved based on corner cells depending on border side.

    Setting cell formatting property on CellRange is propagated to each cell in a range.

    To set Style to one or more cells, simply assign it to Style property.

    tip

    Preferable way to modify formatting property of multiple cells is to get CellRange to which all those cells belong, and use Style property of that range to make the modification.

    If modifying multiple formatting properties of a CellRange, without preserving unmodified formatting properties, preferable way is to create new instance of CellStyle, make modifications on it, and assign it to Style property of that range.

    GemBox.Spreadsheet internally takes care not to allocate unnecessary cells when formatting a range of cells (for example, when formatting Cells) and to cache formatting information of equally formatted cells, at the appropriate time, to reduce memory footprint.

    Exceptions
    System.ArgumentException

    Value cannot be null or empty.

    ScriptPosition

    Gets or sets the vertical position of the text relative to the text's default appearance.

    Default value is Normal.

    • C#
    • VB.NET
    public ScriptPosition ScriptPosition { get; set; }
    Public Property ScriptPosition As ScriptPosition
    Property Value
    ScriptPosition

    The vertical position of the text relative to the text's default appearance.

    Remarks

    Conceptually, cell formatting is divided into following groups:

    • Number - indicates how to format and render the numeric value of a cell. Associated property is NumberFormat.
    • Alignment - formatting information pertaining to text alignment in cells. Associated properties are HorizontalAlignment, VerticalAlignment, Indent, Rotation, IsTextVertical, WrapText and ShrinkToFit.
    • Font - defines the properties for the used font. Associated property is Font.
    • Border - expresses a single set of cell border formats (left, right, top, bottom and diagonal). Associated property is Borders.
    • Fill - specifies fill formatting (pattern or gradient). Associated property is FillPattern.
    • Protection - contains protection properties associated with the cell. Associated properties are Locked and FormulaHidden.

    Additional CellStyle properties not associated with any formatting group are:

    • Name - name of the referenced Style.
    • QuotePrefix - true to store numeric value of a cell as text; otherwise, false.
    • IsDefault - true if Name Style is default (Normal) and there are no additional modifications of cell formatting; otherwise, false.

    ExcelFile contains a set of Styles which can be referenced by multiple cells.

    ExcelFile must always contain at least one Style which cannot be removed and is, by default, referenced by all cells. This default style is Normal.

    Style can either be built-in or user-defined. Built-in style is accessible from Styles via BuiltInCellStyleName enumeration.

    Cell formatting group (Number, Alignment, Font, Border, Fill or Protection) (and its associated properties) is resolved from Name Style, unless cell formatting group or its associated property is modified.

    Cell formatting is available for one or more cells through Style property which is available on ExcelCell and CellRange types. Cell formatting specified on ExcelColumn and ExcelRow types through Style property is simply propagated to cell formatting of its Cells.

    note

    For performance reasons, cell formatting on CellRange is resolved based just on its top-left cell formatting, except borders which are resolved based on corner cells depending on border side.

    Setting cell formatting property on CellRange is propagated to each cell in a range.

    To set Style to one or more cells, simply assign it to Style property.

    tip

    Preferable way to modify formatting property of multiple cells is to get CellRange to which all those cells belong, and use Style property of that range to make the modification.

    If modifying multiple formatting properties of a CellRange, without preserving unmodified formatting properties, preferable way is to create new instance of CellStyle, make modifications on it, and assign it to Style property of that range.

    GemBox.Spreadsheet internally takes care not to allocate unnecessary cells when formatting a range of cells (for example, when formatting Cells) and to cache formatting information of equally formatted cells, at the appropriate time, to reduce memory footprint.

    Size

    Gets or sets the size of the text in twips (1/20th of a point).

    Default value is 11 * 20 = 220.

    • C#
    • VB.NET
    public int Size { get; set; }
    Public Property Size As Integer
    Property Value
    System.Int32

    The size of the text.

    Remarks

    Conceptually, cell formatting is divided into following groups:

    • Number - indicates how to format and render the numeric value of a cell. Associated property is NumberFormat.
    • Alignment - formatting information pertaining to text alignment in cells. Associated properties are HorizontalAlignment, VerticalAlignment, Indent, Rotation, IsTextVertical, WrapText and ShrinkToFit.
    • Font - defines the properties for the used font. Associated property is Font.
    • Border - expresses a single set of cell border formats (left, right, top, bottom and diagonal). Associated property is Borders.
    • Fill - specifies fill formatting (pattern or gradient). Associated property is FillPattern.
    • Protection - contains protection properties associated with the cell. Associated properties are Locked and FormulaHidden.

    Additional CellStyle properties not associated with any formatting group are:

    • Name - name of the referenced Style.
    • QuotePrefix - true to store numeric value of a cell as text; otherwise, false.
    • IsDefault - true if Name Style is default (Normal) and there are no additional modifications of cell formatting; otherwise, false.

    ExcelFile contains a set of Styles which can be referenced by multiple cells.

    ExcelFile must always contain at least one Style which cannot be removed and is, by default, referenced by all cells. This default style is Normal.

    Style can either be built-in or user-defined. Built-in style is accessible from Styles via BuiltInCellStyleName enumeration.

    Cell formatting group (Number, Alignment, Font, Border, Fill or Protection) (and its associated properties) is resolved from Name Style, unless cell formatting group or its associated property is modified.

    Cell formatting is available for one or more cells through Style property which is available on ExcelCell and CellRange types. Cell formatting specified on ExcelColumn and ExcelRow types through Style property is simply propagated to cell formatting of its Cells.

    note

    For performance reasons, cell formatting on CellRange is resolved based just on its top-left cell formatting, except borders which are resolved based on corner cells depending on border side.

    Setting cell formatting property on CellRange is propagated to each cell in a range.

    To set Style to one or more cells, simply assign it to Style property.

    tip

    Preferable way to modify formatting property of multiple cells is to get CellRange to which all those cells belong, and use Style property of that range to make the modification.

    If modifying multiple formatting properties of a CellRange, without preserving unmodified formatting properties, preferable way is to create new instance of CellStyle, make modifications on it, and assign it to Style property of that range.

    GemBox.Spreadsheet internally takes care not to allocate unnecessary cells when formatting a range of cells (for example, when formatting Cells) and to cache formatting information of equally formatted cells, at the appropriate time, to reduce memory footprint.

    Exceptions
    System.ArgumentOutOfRangeException

    Value must be positive.

    Strikeout

    Gets or sets a value indicating whether to draw a strike-through line through the horizontal middle of the text.

    Default value is false.

    • C#
    • VB.NET
    public bool Strikeout { get; set; }
    Public Property Strikeout As Boolean
    Property Value
    System.Boolean

    true to draw a strike-through line through the horizontal middle of the text; otherwise, false.

    Remarks

    Conceptually, cell formatting is divided into following groups:

    • Number - indicates how to format and render the numeric value of a cell. Associated property is NumberFormat.
    • Alignment - formatting information pertaining to text alignment in cells. Associated properties are HorizontalAlignment, VerticalAlignment, Indent, Rotation, IsTextVertical, WrapText and ShrinkToFit.
    • Font - defines the properties for the used font. Associated property is Font.
    • Border - expresses a single set of cell border formats (left, right, top, bottom and diagonal). Associated property is Borders.
    • Fill - specifies fill formatting (pattern or gradient). Associated property is FillPattern.
    • Protection - contains protection properties associated with the cell. Associated properties are Locked and FormulaHidden.

    Additional CellStyle properties not associated with any formatting group are:

    • Name - name of the referenced Style.
    • QuotePrefix - true to store numeric value of a cell as text; otherwise, false.
    • IsDefault - true if Name Style is default (Normal) and there are no additional modifications of cell formatting; otherwise, false.

    ExcelFile contains a set of Styles which can be referenced by multiple cells.

    ExcelFile must always contain at least one Style which cannot be removed and is, by default, referenced by all cells. This default style is Normal.

    Style can either be built-in or user-defined. Built-in style is accessible from Styles via BuiltInCellStyleName enumeration.

    Cell formatting group (Number, Alignment, Font, Border, Fill or Protection) (and its associated properties) is resolved from Name Style, unless cell formatting group or its associated property is modified.

    Cell formatting is available for one or more cells through Style property which is available on ExcelCell and CellRange types. Cell formatting specified on ExcelColumn and ExcelRow types through Style property is simply propagated to cell formatting of its Cells.

    note

    For performance reasons, cell formatting on CellRange is resolved based just on its top-left cell formatting, except borders which are resolved based on corner cells depending on border side.

    Setting cell formatting property on CellRange is propagated to each cell in a range.

    To set Style to one or more cells, simply assign it to Style property.

    tip

    Preferable way to modify formatting property of multiple cells is to get CellRange to which all those cells belong, and use Style property of that range to make the modification.

    If modifying multiple formatting properties of a CellRange, without preserving unmodified formatting properties, preferable way is to create new instance of CellStyle, make modifications on it, and assign it to Style property of that range.

    GemBox.Spreadsheet internally takes care not to allocate unnecessary cells when formatting a range of cells (for example, when formatting Cells) and to cache formatting information of equally formatted cells, at the appropriate time, to reduce memory footprint.

    UnderlineStyle

    Gets or sets the underline formatting of the text.

    Default value is None.

    • C#
    • VB.NET
    public UnderlineStyle UnderlineStyle { get; set; }
    Public Property UnderlineStyle As UnderlineStyle
    Property Value
    UnderlineStyle

    The underline formatting of the text.

    Remarks

    Conceptually, cell formatting is divided into following groups:

    • Number - indicates how to format and render the numeric value of a cell. Associated property is NumberFormat.
    • Alignment - formatting information pertaining to text alignment in cells. Associated properties are HorizontalAlignment, VerticalAlignment, Indent, Rotation, IsTextVertical, WrapText and ShrinkToFit.
    • Font - defines the properties for the used font. Associated property is Font.
    • Border - expresses a single set of cell border formats (left, right, top, bottom and diagonal). Associated property is Borders.
    • Fill - specifies fill formatting (pattern or gradient). Associated property is FillPattern.
    • Protection - contains protection properties associated with the cell. Associated properties are Locked and FormulaHidden.

    Additional CellStyle properties not associated with any formatting group are:

    • Name - name of the referenced Style.
    • QuotePrefix - true to store numeric value of a cell as text; otherwise, false.
    • IsDefault - true if Name Style is default (Normal) and there are no additional modifications of cell formatting; otherwise, false.

    ExcelFile contains a set of Styles which can be referenced by multiple cells.

    ExcelFile must always contain at least one Style which cannot be removed and is, by default, referenced by all cells. This default style is Normal.

    Style can either be built-in or user-defined. Built-in style is accessible from Styles via BuiltInCellStyleName enumeration.

    Cell formatting group (Number, Alignment, Font, Border, Fill or Protection) (and its associated properties) is resolved from Name Style, unless cell formatting group or its associated property is modified.

    Cell formatting is available for one or more cells through Style property which is available on ExcelCell and CellRange types. Cell formatting specified on ExcelColumn and ExcelRow types through Style property is simply propagated to cell formatting of its Cells.

    note

    For performance reasons, cell formatting on CellRange is resolved based just on its top-left cell formatting, except borders which are resolved based on corner cells depending on border side.

    Setting cell formatting property on CellRange is propagated to each cell in a range.

    To set Style to one or more cells, simply assign it to Style property.

    tip

    Preferable way to modify formatting property of multiple cells is to get CellRange to which all those cells belong, and use Style property of that range to make the modification.

    If modifying multiple formatting properties of a CellRange, without preserving unmodified formatting properties, preferable way is to create new instance of CellStyle, make modifications on it, and assign it to Style property of that range.

    GemBox.Spreadsheet internally takes care not to allocate unnecessary cells when formatting a range of cells (for example, when formatting Cells) and to cache formatting information of equally formatted cells, at the appropriate time, to reduce memory footprint.

    Weight

    Gets or sets the font weight (font boldness).

    Value must be between MinWeight and MaxWeight.

    For standard boldness, use BoldWeight.

    Default value is NormalWeight.

    • C#
    • VB.NET
    public int Weight { get; set; }
    Public Property Weight As Integer
    Property Value
    System.Int32

    The font weight (font boldness).

    Remarks

    Conceptually, cell formatting is divided into following groups:

    • Number - indicates how to format and render the numeric value of a cell. Associated property is NumberFormat.
    • Alignment - formatting information pertaining to text alignment in cells. Associated properties are HorizontalAlignment, VerticalAlignment, Indent, Rotation, IsTextVertical, WrapText and ShrinkToFit.
    • Font - defines the properties for the used font. Associated property is Font.
    • Border - expresses a single set of cell border formats (left, right, top, bottom and diagonal). Associated property is Borders.
    • Fill - specifies fill formatting (pattern or gradient). Associated property is FillPattern.
    • Protection - contains protection properties associated with the cell. Associated properties are Locked and FormulaHidden.

    Additional CellStyle properties not associated with any formatting group are:

    • Name - name of the referenced Style.
    • QuotePrefix - true to store numeric value of a cell as text; otherwise, false.
    • IsDefault - true if Name Style is default (Normal) and there are no additional modifications of cell formatting; otherwise, false.

    ExcelFile contains a set of Styles which can be referenced by multiple cells.

    ExcelFile must always contain at least one Style which cannot be removed and is, by default, referenced by all cells. This default style is Normal.

    Style can either be built-in or user-defined. Built-in style is accessible from Styles via BuiltInCellStyleName enumeration.

    Cell formatting group (Number, Alignment, Font, Border, Fill or Protection) (and its associated properties) is resolved from Name Style, unless cell formatting group or its associated property is modified.

    Cell formatting is available for one or more cells through Style property which is available on ExcelCell and CellRange types. Cell formatting specified on ExcelColumn and ExcelRow types through Style property is simply propagated to cell formatting of its Cells.

    note

    For performance reasons, cell formatting on CellRange is resolved based just on its top-left cell formatting, except borders which are resolved based on corner cells depending on border side.

    Setting cell formatting property on CellRange is propagated to each cell in a range.

    To set Style to one or more cells, simply assign it to Style property.

    tip

    Preferable way to modify formatting property of multiple cells is to get CellRange to which all those cells belong, and use Style property of that range to make the modification.

    If modifying multiple formatting properties of a CellRange, without preserving unmodified formatting properties, preferable way is to create new instance of CellStyle, make modifications on it, and assign it to Style property of that range.

    GemBox.Spreadsheet internally takes care not to allocate unnecessary cells when formatting a range of cells (for example, when formatting Cells) and to cache formatting information of equally formatted cells, at the appropriate time, to reduce memory footprint.

    Exceptions
    System.ArgumentOutOfRangeException

    Value must be between MinWeight and MaxWeight.

    Methods

    ToString()

    Returns a System.String that represents this ExcelFont instance.

    • C#
    • VB.NET
    public override string ToString()
    Public Overrides Function ToString As String
    Returns
    System.String

    A System.String that represents this ExcelFont instance.

    Overrides
    System.Object.ToString()
    Remarks

    This method should be used primarily for debugging purposes and should be considered volatile (format of its return value might change in future versions).

    See Also

    Font
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.