Ticket Q460652
Visible to All Users

How to prevent a specific content from being pasted into RichEditControl

created 11 years ago

Hello,
In some cases we do not allow users to paste large content objects such as images. The RTF size just gets too large too fast with images and we end up with Large Object Heap fragmentation very quickly which eventually results in Out of Memory exceptions. Another option would be to scale down the image resolution for the user to reduce the memory size (we do not do that).

Answers approved by DevExpress Support

created 11 years ago (modified 11 years ago)

Hi Clint,
If you wish to analyze and execute custom logic when an RTF content is inserted in a RichEditControl instance, you can implement it in a custom PasteSelectionCommand command.
Please refer to the following threads, where we have demonstrated how it can be achieved:
Floating is not Working in RichTextEdit
How to customize copy and paste commands
I have created a simple sample that illustrates how to analyze the inserted content in a custom PasteSelectionCoreCommand descendant. Please find it in the attachement.

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.