Skip to main content

XlRichTextString.Text Property

Gets or sets the full rich text of a cell.

Namespace: DevExpress.Export.Xl

Assembly: DevExpress.Printing.v23.2.Core.dll

NuGet Package: DevExpress.Printing.Core

Declaration

public string Text { get; set; }

Property Value

Type Description
String

A String value that specifies the text displayed in a cell.

Remarks

A worksheet cell may contain a rich formatted text that represents a cell text divided into separate regions (so-called text runs), each of which has its own set of font characteristics. Each text run is defined by the XlRichTextRun object and is stored in the collection of runs accessible from the XlRichTextString.Runs property.

When you create a new XlRichTextString object to specify the rich formatted text for a cell and set its content using the Text property, the XlRichTextString.Runs collection includes a single run that holds the full cell text formatted with the default font. To change the font of this text, access this run object by its index in the collection and set its XlRichTextRun.Font property to the required value. Note that you can also add more regions to the existing cell text using the Add method of the XlRichTextString.Runs collection. If there are several runs within the cell text, the Text property returns a string that combines all text regions specified by these runs.

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

See Also