![]() ![]() ' representing the plain text content of the TextRange. ' The Text property on a TextRange object returns a string ' TextPointer to the end of content in the RichTextBox.ĭim textRange As New TextRange(, ) ' TextPointer to the start of content in the RichTextBox. Private Function StringFromRichTextBox(ByVal rtb As RichTextBox) As String representing the plain text content of the TextRange. The Text property on a TextRange object returns a string TextPointer to the end of content in the RichTextBox. TextPointer to the start of content in the RichTextBox. string StringFromRichTextBox(RichTextBox rtb) TextRange provides a Text property, which returns the plain text portions of the TextRange as a string. ContentStart and ContentEnd properties each return a TextPointer, and are accessible on the underlying FlowDocument that represents the contents of the RichTextBox. Then, click Add button to add the text string into the AutoText pane. In the AutoText pane, please click button, and enter a name and specify the category for this text as following screenshot shown: 3. The method creates a new TextRange from the contents of the RichTextBox, using the ContentStart and ContentEnd to indicate the range of the contents to extract. Select the text string that you want to repeat, and then click Kutools > Auto Text, see screenshot: 2. The following code implements a method that takes a RichTextBox as an argument, and returns a string representing the plain text contents of the RichTextBox. Ĭode example with RichTextBox as an argument The following Extensible Application Markup Language (XAML) code describes a named RichTextBox control with simple content. This example shows how to extract the contents of a RichTextBox as plain text. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |