Back to Devexpress

RichTextString.Runs Property

officefileapi-devexpress-dot-spreadsheet-dot-richtextstring.md

latest4.9 KB
Original Source

RichTextString.Runs Property

Provides access to a collection of text runs that compose rich text in a cell.

Namespace : DevExpress.Spreadsheet

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
public IEnumerable<RichTextRun> Runs { get; }
vb
Public ReadOnly Property Runs As IEnumerable(Of RichTextRun)

Property Value

TypeDescription
IEnumerable<RichTextRun>

A IEnumerable<T><RichTextRun,> collection.

|

Remarks

A worksheet cell may contain a rich formatted text that represents a cell text divided into separate regions - text runs, each with its own set of font characteristics. Each run is defined by the RichTextRun object and is stored in the Runs collection. To view a run’s text and font settings, use the RichTextRun.Text and RichTextRun.Font properties, respectively.

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

Call the CellRange.SetRichText method to assign the rich formatted text to a cell.

For details 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.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Runs property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-spreadsheet-how-to-edit-rich-text/VB/SpreadsheetRichText/RichTextEditForm.vb#L17

vb
Dim document As Document = RichEditControl1.Document
For Each run As RichTextRun In richText.Runs
    Dim range As DocumentRange = document.InsertText(document.Range.End, run.Text)

See Also

AddTextRun(String, RichTextRunFont)

Characters

How to: Apply Rich Formatting to Cell Text

RichTextString Class

RichTextString Members

DevExpress.Spreadsheet Namespace