We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Enable only Paste Value on Context Menu

I'm working on a spreadsheet and using the context menu to implement a Cut/Copy/Paste implementation.

However I only want the user to be able to paste values and not formula/formatting etc.

I can't seem to find a way to do this - in the context menu I could think about removing/hiding the items and creating my own implementations however this would seem like a lot of work and wouldnt cover the use of any of the shortcut keys such as Ctrl+V.

Any pointers in best way to implement this Paste Only Value functionality.

1 Reply

AA Arulraj A Syncfusion Team January 28, 2019 11:19 AM UTC

Hi Spotty, 

Thanks for using Syncfusion product. 

Suggestion1 

By default, Spreadsheet does have the support to change the default paste option using DefaultPasteOption property. Please refer the following code example. 

VB 
Me.spreadsheet.CopyPaste.DefaultPasteOption = Syncfusion.Windows.Forms.Spreadsheet.PasteOptions.Value 

To avoid the paste popup showing when press the ctrl+v, you could disable the AllowPasteOptionPopup property. Please refer the following code example. 

VB 
Me.spreadsheet.CopyPaste.AllowPasteOptionPopup = False 

Suggestion2 

Also, you can set the default paste option using PateOption property in Pasting event which is only paste the value based on the PasteOption value. Please refer the following code example. 

VB 
AddHandler Me.spreadsheet.CopyPaste.Pasting, AddressOf SpreadSheet_Pasting 

Private Sub SpreadSheet_Pasting(sender As Object, e As SpreadsheetPastingEventArgs) 
    e.PasteOption = Syncfusion.Windows.Forms.Spreadsheet.PasteOptions.Value 
End Sub 


Please refer the below UG link for programmatical implementation for Cut/Copy/Paste operations 

Please let us know if you need any further assistance on this. 

Arulraj A 


Loader.
Live Chat Icon For mobile
Up arrow icon