windowsforms-devexpress-dot-xtrarichedit-dot-richeditcontrol-d95ab1cd.md
Copies the content of the selection to the Clipboard.
Namespace : DevExpress.XtraRichEdit
Assembly : DevExpress.XtraRichEdit.v25.2.dll
NuGet Package : DevExpress.Win.RichEdit
public void Copy()
Public Sub Copy
The following code finds all occurrences of the “text from RichEditControl” phrase using the SubDocument.FindAll method, selects and copies them.
richEditControl.Text = "Open any text editor (Notepad, Word) and press the 'Ctrl+V' shortcut, the 'text from RichEditControl' string will be pasted into the editor's document";
DocumentRange[] foundRanges = richEditControl.Document.FindAll("text from RichEditControl", SearchOptions.None);
richEditControl.Document.Selection = foundRanges[0];
richEditControl.Copy();
richEditControl.Text = "Open any text editor (Notepad, Word) and press the 'Ctrl+V' shortcut, the 'text from RichEditControl' string will be pasted into the editor's document"
Dim foundedRanges() As DocumentRange = richEditControl.Document.FindAll("text from RichEditControl", SearchOptions.None)
richEditControl.Document.Selection = foundedRanges(0)
richEditControl.Copy()
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Copy() method.
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#L542
richEditControl.Document.Selection = foundRanges[0];
richEditControl.Copy();
#endregion #CopySelectedText
winforms-richeditcontrol-common-api/VB/RichEditAPISample/CodeExamples/RichEditControlActions.vb#L552
richEditControl.Document.Selection = foundedRanges(0)
richEditControl.Copy()
' #End Region ' #CopySelectedText
See Also