# Rich Text Editing

Learn how to enable rich text editing in Spread for WinForms and manipulate font settings at runtime.

## Content

The **Rich Text Editing** feature in Spread for WinForms helps to render different text styles and add formulas in the worksheet. The **IFeatures** interface provides the **RichTextEdit** property to indicate whether the rich text is editable or not.
![](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/rich-text-all-features.png)
The **FarPoint.Win.Spread** namespace provides the **RichTextEditMode** enumeration to indicate whether you can edit rich text in Spread worksheet. This enumeration provides three values:

* **Legacy**: Value in the cell is edited as plain text.
* **On**: Value in the cell is edited as rich text.
* **Unspecified**: Rich text editing mode is determined via **FarPoint.Win.Spread.FpSpread.EditModeStarting** event.

To use the rich text editing feature, enable the **flat style** mode in Spread, and set the **RichTextEditMode** to On.

```csharp
// Flat style
fpSpread1.LegacyBehaviors = LegacyBehaviors.None;
// Enable rich text editing
fpSpread1.Features.RichTextEdit = RichTextEditMode.On;
```

## Font Dialog

You can show the built-in Font editor dialog to edit font settings for the currently selected text using the **FormatCells** method of the **BuiltInDialogs** class. To learn more about the dialog, see [Working with BuiltInDialogs](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssojbects/work-with-builtin-dialog).

```csharp
if (fpSpread1.EditingControl is IRichTextEditor richTextEditor)
{
    BuiltInDialogs.FormatCells(richTextEditor);
}
```

You can manipulate the font of the text while editing a cell in the worksheet using the **Format Cells** dialog at runtime, for example, you can change the font type, font style, text size, text color, text effects, etc.
![](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/font-format-dialog.png)
Spread allows you to manipulate the rich text editor using the **IRichTextEditor** interface. Here is an example of toggling the bold settings when the user edits a cell.
![](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/font-rte.gif)

```csharp
private void ToggleBold(FpSpread spread)
{
    if (spread.EditingControl is IRichTextEditor richTextEditor)
    {
       GrapeCity.Spreadsheet.Font font = GrapeCity.Spreadsheet.Font.Empty;
       font.Bold = !richTextEditor.SelectionFont.Bold;
       richTextEditor.ApplyFont(font, -1, -1); //apply to current selected text
    }
}
```

## Insert Function dialog

You can show the Insert Function dialog using the **ToggleInsertFunction** property of the **BuiltInDialogs** class. To learn more about the dialog, see [Working with BuiltInDialogs](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssojbects/work-with-builtin-dialog).
The Spread Designer UI provides many rich text editing features like Intellisense support, auto-complete, pick from dropdown list, etc. You can learn more about the rich text editing feature in Spread Designer from the [Rich Text Editing](/spreadnet/docs/latest/online-win/overview/spwin-designerguide/spwin-spd-design/rich-text-editing-design) topic in the **Designing in the Data Area** section.