This example illustrates how to use the IRichEditCommandFactoryService service substitution to override CopySelectionCommand
and PasteSelectionCommand
behavior.
Customized CopySelectionCommand
copies selection to the Clipboard in HTML Clipboard Format (see the HtmlHelper.GetHtmlClipboardFormat()
method). This allows you to copy the RichEditControl content and paste it directly to a control that can accept HTML-formatted data from the Clipboard (e. g. ASPxHtmlEditor). Note that images are embedded into the resulting HTML according to the Data URI scheme specification to avoid dependency on the image location (it may not be resolved by the target application).
Note:
Starting with v20.2.5, RichEditControl supports copying data in the HTML Clipboard format. To enable this functionality, use the ClipboardFormats.Html option.
The customized PasteSelectionCommand
retrieves plain (unformatted) text from the Clipboard and pastes this text into the RichEditControl.
- Form1.cs (VB: Form1.vb)
- CustomCommands.cs (VB: CustomCommands.vb)
- HtmlRelatedClasses.cs (VB: HtmlRelatedClasses.vb)
- Commands in Rich Text Editor
- How to: Bind a Command to a Button in the Rich Text Editor for WinForms
- How to: Replace a Built-In Command with a Custom Command in Rich Text Editor for WinForms
(you will be redirected to DevExpress.com to submit your response)