windowsforms-devexpress-dot-xtrarichedit-dot-richeditcontrol-2c6a3674.md
Gets or sets the formatted text content of the control.
Namespace : DevExpress.XtraRichEdit
Assembly : DevExpress.XtraRichEdit.v25.2.dll
NuGet Package : DevExpress.Win.RichEdit
[Bindable(true)]
[Browsable(false)]
public string RtfText { get; set; }
<Bindable(True)>
<Browsable(False)>
Public Property RtfText As String
| Type | Description |
|---|---|
| String |
A string, containing the document’s content in rich text format.
|
Use this property to load an RTF content to the RichEditControl.
The RtfText property value is loaded as a new document in the rich text format. Check the RtfText property value when the RichEditControl.DocumentLoaded event handler, i.e. when the document is fully loaded.
The following code snippet displays the word “Test” in blue.
string rtfString = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1049
{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}
{\f1\fswiss\fcharset0 Arial;}}
{\colortbl ;\red0\green0\blue255;}
\viewkind4\uc1\pard\cf1\lang1033\b\f0\fs32 Test.\cf0\b0\f1\fs20\par}";
document.RtfText = rtfString;
Dim rtfString As String = "{\rtf1\ansi\ansicpg1252\deff0\deflang1049{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\fswiss\fcharset0 Arial;}}{\colortbl ;\red0\green0\blue255;}\viewkind4\uc1\pard\cf1\lang1033\b\f0\fs32 Test.\cf0\b0\f1\fs20\par}"
document.RtfText = rtfString
The following code snippets (auto-collected from DevExpress Examples) contain references to the RtfText 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.
how-to-load-a-document-into-the-richedit-control/CS/LoadDocumentExample/Form1.cs#L46
#region #fromstring
richEditControl1.RtfText = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1049
{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}
word-processing-merge-documents-with-different-headers-and-footers/CS/DocumentMerger/Form1.cs#L26
Document mergedDoc = DocumentsMerger.MergeDouments(filenames);
richEditControl1.RtfText = mergedDoc.RtfText;
}
how-to-load-a-document-into-the-richedit-control/VB/LoadDocumentExample/Form1.vb#L41
' #Region "#fromstring"
richEditControl1.RtfText = "{\rtf1\ansi\ansicpg1252\deff0\deflang1049" &
"{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}" &
word-processing-merge-documents-with-different-headers-and-footers/VB/DocumentMerger/Form1.vb#L21
Dim mergedDoc As Document = DocumentsMerger.MergeDouments(filenames)
richEditControl1.RtfText = mergedDoc.RtfText
End Sub
See Also