Skip to content

Use the service substitution technique to change the actions performed when the built-in command is executed.

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/how-to-customize-copy-and-paste-commands

Repository files navigation

How to: Customize Copy and Paste Commands

This example illustrates how to use the IRichEditCommandFactoryService service substitution to override CopySelectionCommand and PasteSelectionCommand behavior.

Implementation Details

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.

Files to Review

More Examples

Documentation

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

About

Use the service substitution technique to change the actions performed when the built-in command is executed.

Topics

Resources

License

Stars

Watchers

Forks