Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+
Row

RichTextString.Characters(Int32) Method

Returns a range of characters that starts at the specified position and continues to the end of the rich text string.

Namespace: DevExpress.Spreadsheet

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

Declaration

public RichTextRange Characters(
    int start
)

Parameters

Name Type Description
start Int32

An integer that is the zero-based character position from which the required text range starts.

Returns

Type Description
RichTextRange

A RichTextRange object that represents a range of characters within the cell text.

Remarks

Use the Characters method to format specific characters within the cell text. This method returns the RichTextRange object that represents the text subset and allows you to set its font characteristics using the RichTextRange.Font property or RichTextRange.SetFont method. To assign the rich formatted text to a cell, call the Range.SetRichText method.

When you use the Characters method to apply rich formatting to a region of cell text, a corresponding RichTextRun object is created and added to the RichTextString.Runs collection. However, if the font settings you specify for text characters coincide with the previous or next run of the cell’s rich text, these runs are combined into a single text run and a new item is not created.

To view font characteristics applied to a portion of cell text, use the RichTextRange.Font property. This property returns the SpreadsheetFontProperties object that contains font attributes of the specified text range. If this text range includes multiple text runs, the SpreadsheetFontProperties property values are null for differing font characteristics.

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