The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
All docs
V19.1
19.2 (EAP/Beta)
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
18.2
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
Row

Range.SetRichText(RichTextString) Method

Assigns the rich formatted text to a cell.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v19.1.Core.dll

Declaration

void SetRichText(RichTextString value)
Sub SetRichText(value As RichTextString)
void SetRichText(RichTextString value)
Sub SetRichText(value As RichTextString)

Parameters

Name Type Description
value RichTextString

A RichTextString object that is a combination of specifically formatted text regions.

Parameters

Name Type Description
value RichTextString

A RichTextString object that is a combination of specifically formatted text regions.

Remarks

Use the SetRichText method to add rich formatted text to a cell. Such rich text is defined by the RichTextString object and represents a cell text divided into separate regions (so-called text runs), each with its own set of font characteristics.

Spreadsheet_RichText

To apply rich formatting to the cell text, do one of the following:

Pass the RichTextString instance to the SetRichText method to assign the specified rich text to a cell. The resulting text string is also set to the cell's Range.Value as plain text.

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

// Add three text runs. Each run has its own font settings.
richText.AddTextRun("Rich ", new RichTextRunFont("Arial", 14, System.Drawing.Color.FromArgb(0xc5, 0x9f, 0xc9)));
richText.AddTextRun("text ", new RichTextRunFont("Tahoma", 14, System.Drawing.Color.FromArgb(0x2c, 0x60, 0x8e)));
richText.AddTextRun("formatting", new RichTextRunFont("Castellar", 14, System.Drawing.Color.FromArgb(0x2f, 0x24, 0x4f)));

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

For more examples on how to apply different fonts to specific regions of the cell text, refer to the How to: Apply Rich Formatting to Cell Text document.

See Also