[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
   [Expand]Product Information
    Product Structure
    Getting Started
   [Expand]Spreadsheet Document
    Supported Formats
   [Expand]Cell Basics
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
    Data Grouping
   [Expand]Pivot Tables
   [Expand]Charts and Graphics
   [Expand]Mail Merge
    Operation Restrictions
    Find and Replace
   [Expand]Visual Elements
   [Expand]Keyboard Shortcuts
    [Expand]Rows and Columns
    [Expand]Import and Export Data
    [Expand]Data Binding
    [Expand]Mail Merge
    [Collapse]Formatting Cells
      How to: Apply a Style to a Cell or Range of Cells
      How to: Create or Modify a Style
      How to: Format a Cell or Range of Cells
      How to: Apply Rich Formatting to Cell Text
      How to: Specify Number or Date Format for Cell Content
      How to: Change Cell Font and Background Color
      How to: Apply Gradient Fill
      How to: Configure Cell Font Settings
      How to: Align Cell Content
      How to: Add and Remove Cell Borders
      How to: Clear Cell Formatting
    [Expand]Conditional Formatting
    [Expand]Group Data
    [Expand]Filter Data
    [Expand]Pivot Tables
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Apply Rich Formatting to Cell Text

The RichTextString class provides the means to format text values within spreadsheet cells. Rich text consists of one or more text regions (or text runs), each with its own set of font characteristics. The RichTextString.Runs property provides access to a collection of text runs. A RichTextRun object represents an individual run within a collection.

Expanded Create Rich Text

Use the following members to apply rich formatting to the cell's text.




Adds a new text run with the specified font settings to the rich text string.


Allows you to format specific characters within the cell's text.



Allows you to specify font attributes for specific characters within the cell's text.


Gets or sets the full text displayed in a cell.


Assigns rich formatted text to a cell.

  • Example I

    The following code snippet uses the RichTextString.AddTextRun method to compose the cell's text from individual text runs.

  • Example II

    The code snippet below uses the RichTextString.Characters method to format a portion of the cell's text.

Expanded Access Rich Text


Checks whether a cell contains rich formatted text.


Retrieves rich text from a cell.


Allows you to iterate through a collection of the existing text runs.


Gets the current run's text.


Gets font attributes applied to the current run.

Expanded Format Characters within an Existing Text

The following example shows how to apply rich formatting to a cell that already contains a text value.

Expanded Obtain the Entire Rich Text String and Its Length


Gets or sets the full text contained in a cell.

You can also use the cell's CellRange.Value property to obtain the resulting text string as plain text.


Returns the rich text length.

Is this topic helpful?​​​​​​​