Skip to main content

How to: Configure Cell Font Settings

  • 2 minutes to read

Use the SpreadsheetFont object’s properties to specify font attributes for worksheet cells and cell ranges.

The Cell.Font property allows you to modify the font for an individual cell.

To change font characteristics for a cell range, call the CellRange.BeginUpdateFormatting method for this range, use the Font property of the returned object to access and modify the SpreadsheetFont properties, and call the CellRange.EndUpdateFormatting method to finalize modifications.

The SpreadsheetFont object contains the following properties used to change cell font attributes:

Create and modify cell styles to apply multiple format attributes to worksheet cells simultaneously.

The following example demonstrates how to specify cell font characteristics (font name, size, color, and style).

View Example

// Access the Font object.
SpreadsheetFont cellFont = worksheet.Cells["A1"].Font;
// Set the font name.
cellFont.Name = "Times New Roman";
// Set the font size.
cellFont.Size = 14;
// Set the font color.
cellFont.Color = Color.Blue;
// Format text as bold.
cellFont.Bold = true;
// Set font to be underlined.
cellFont.UnderlineType = UnderlineType.Single;

The image below shows the result.

SpreadsheetControl_FontSettings

See Also