[Expand]General Information
[Expand]WinForms Controls
[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
[Collapse]Office File API
  Demo Application
  Redistribution and Deployment
 [Collapse]Spreadsheet Document API
   Product Structure
   Getting Started
  [Expand]Spreadsheet Document
   Supported Formats
  [Expand]Cell Basics
   Defined Names
   Data Binding
  [Expand]Pivot Tables
  [Expand]Charts and Graphics
  [Expand]Mail Merge
   [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: 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]Word Processing Document API
 [Expand]PDF Document API
 [Expand]Excel Export Library
 [Expand]Snap Report API
 [Expand]Zip Compression and Archive API
 [Expand]Barcode Generation API
 [Expand]Unit Conversion API
 [Expand]API Reference
[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 Range.Value property to obtain the resulting text string as plain text.


Returns the rich text length.

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