Back to Devexpress

RichEditControl.Text Property

windowsforms-devexpress-dot-xtrarichedit-dot-richeditcontrol-cd2e6d23.md

latest7.0 KB
Original Source

RichEditControl.Text Property

Gets or sets the control’s content as a plain text.

Namespace : DevExpress.XtraRichEdit

Assembly : DevExpress.XtraRichEdit.v25.2.dll

NuGet Package : DevExpress.Win.RichEdit

Declaration

csharp
public override string Text { get; set; }
vb
Public Overrides Property Text As String

Property Value

TypeDescription
String

A string, containing the document’s unformatted text.

|

Remarks

Use the Text property to get the plain text displayed in the RichEditControl.

csharp
richEditControl.Text = "Item 1\r\nItem 2\r\nItem 3\r\nItem 4\r\n";
vb
richEditControl.Text = "Item 1" & vbCrLf & "Item 2" & vbCrLf & "Item 3" & vbCrLf & "Item 4" & vbCrLf

The RichEditControl.ContentChanged event fires when the document is loaded using the Text property.

Check the Text property value in the RichEditControl.DocumentLoaded event handler, i.e., when the document is fully loaded.

Use the following properties to retrieve text in other formats:

The following code snippets (auto-collected from DevExpress Examples) contain references to the Text 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-richeditcontrol-common-api/CS/RichEditAPISample/CodeExamples/RichEditControlActions.cs#L20

csharp
buttonCustomAction.Tag = richEditControl;
richEditControl.Text = "Click the 'Custom Action' button located in the ribbon to invoke the 'Find and Replace' dialog switched to the 'Find' tab and with the 'test' word used for search";
#endregion #ShowSearchFormMethod

winforms-richedit-syntax-highlighting-with-devexpress-codeparser-library/CS/WindowsFormsApplication1/Form1.cs#L22

csharp
server.Text = "some HTML text";
    richEditControl1.Text = server.HtmlText;
}

winforms-tabbed-ui-control-based-document/CS/DcoumentManagerContentGenerator/Form1.cs#L31

csharp
newTB.Name = s + index.ToString();
newTB.Text = s + " " + index.ToString();
documentManager2.View.BeginUpdate();

winforms-spell-checker-get-started/CS/XtraSpellCheckerGetStarted/Form1.cs#L23

csharp
richTextBox1.Text = sText;
richEditControl1.Text = sText;

winforms-richedit-adjust-left-document-padding/CS/Form1.cs#L19

csharp
richEditControl1.Text = "Test";
}

winforms-richeditcontrol-common-api/VB/RichEditAPISample/CodeExamples/RichEditControlActions.vb#L22

vb
buttonCustomAction.Tag = richEditControl
            richEditControl.Text = "Click the 'Custom Action' button located on the RibbonControl to invoke the 'Find and Replace' dialog switched to the 'Search' tab and with the 'test' word used for search"
' #End Region ' #ShowSearchFormMethod

winforms-richedit-syntax-highlighting-with-devexpress-codeparser-library/VB/WindowsFormsApplication1/Form1.vb#L21

vb
server.Text = "some HTML text"
    richEditControl1.Text = server.HtmlText
End Using

winforms-tabbed-ui-control-based-document/VB/DcoumentManagerContentGenerator/Form1.vb#L33

vb
newTB.Name = s & index.ToString()
newTB.Text = s & " " & index.ToString()
documentManager2.View.BeginUpdate()

winforms-spell-checker-get-started/VB/XtraSpellCheckerGetStarted/Form1.vb#L19

vb
richTextBox1.Text = sText
    richEditControl1.Text = sText
End Sub

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

vb
Else
    RichEditControl1.Text = cell.DisplayText
End If

See Also

RichEditControl Class

RichEditControl Members

DevExpress.XtraRichEdit Namespace