Skip to main content

XlFontBase.Size Property

Gets or sets the size of the font applied to the cell content.

Namespace: DevExpress.Export.Xl

Assembly: DevExpress.Printing.v23.2.Core.dll

NuGet Package: DevExpress.Printing.Core

Declaration

public double Size { get; set; }

Property Value

Type Description
Double

A Double value specifying the font size in points.

Remarks

To specify all the required font characteristics, use the XlFont object properties such as XlFontBase.Name, XlFontBase.Script, XlFontBase.Underline, XlFontBase.Bold, XlFontBase.Italic, XlFont.Color etc.

You can also use the static XlFont.CustomFont method to set a font with the specified face name, color and size.

// Add a new worksheet to the document. 
using (IXlSheet sheet = document.CreateSheet()) {
    // Create the first row.
    using (IXlRow row = sheet.CreateRow()){
        // Create the first cell in the row.
        using (IXlCell cell = row.CreateCell()){
            // Set the cell value.
            cell.Value = "Custom font #1";
            // Specify the custom font attributes.
            XlFont font = new XlFont();
            font.Name = "Century Gothic";
            font.SchemeStyle = XlFontSchemeStyles.None;
            font.Size = 14;
            font.Color = Color.DeepSkyBlue;
            font.Bold = true;
            // Apply the custom font to the cell content.
            cell.ApplyFormatting(font);
        }
    }

    sheet.SkipRows(1);

    // Create the third row.
    using (IXlRow row = sheet.CreateRow()){
        // Create the first cell in the row.
        using (IXlCell cell = row.CreateCell())
        {
            // Set the cell value.
            cell.Value = "Custom font #2";
            // Specify the custom font attributes.
            XlFont font = XlFont.CustomFont("Courier New", 14, Color.BlueViolet);
            font.Italic = true;
            // Apply the custom font to the cell content.
            cell.ApplyFormatting(font);
        }
    }
}

For more examples on how to specify font settings for an individual cell, refer to the How to: Configure Cell Font Settings article.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Size property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also