Skip to main content
Row

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

RichTextRange Interface

A range of characters within a cell’s rich text.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v24.2.Core.dll

NuGet Package: DevExpress.Spreadsheet.Core

#Declaration

public interface RichTextRange

The following members return RichTextRange objects:

#Remarks

A RichTextRange object is returned by the RichTextString.Characters method that allows you to format specific characters within the cell text. Use the object’s RichTextRange.Font property or RichTextRange.SetFont method to change font characteristics for the specified portion of the cell text. To assign the rich formatted text to a cell, call the CellRange.SetRichText method.

// Create a RichTextString instance.
RichTextString richText = new RichTextString();

// Specify the cell text.
richText.Text = "Rich text formatting";
// Change font characteristics of the first word.
richText.Characters(0, 4).SetFont(new RichTextRunFont("Calibri", 12, System.Drawing.Color.Red));

// Assign the rich formatted text to the cell B2.
worksheet["B2"].SetRichText(richText);

Refer to the How to: Apply Rich Formatting to Cell Text document for more examples on how to apply rich formatting to the cell content.

See Also