This is a migrated thread and some comments may be shown as answers.

Range Copy Paste

13 Answers 309 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 1
Marc asked on 11 Aug 2017, 01:15 PM

Hi,

Is there anyway to overwrite the default value of the copy / paste functionality so that when a user copies a range and pastes it, the copy range formatting is not copied? (ie, copy value only)

Or is there some event I can intercept and use to do this?

Thanks

Marc

13 Answers, 1 is accepted

Sort by
0
Accepted
Ivan Danchev
Telerik team
answered on 15 Aug 2017, 08:17 AM
Hi Marc,

Currently there is no configuration option that allows to enable/disable pasting cells with/without formatting. We are considering the implementation of such in a future release. A possible workaround exists and consists of overwriting the paste function of the prototype as shown in this dojo example. 

Regards,
Ivan Danchev
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Marc
Top achievements
Rank 1
answered on 15 Aug 2017, 10:56 AM

Hi Ivan!

This is great, thanks so much!

0
Marc
Top achievements
Rank 1
answered on 26 Aug 2017, 07:47 PM

Hi Ivan

In the example dojo, the formatting is copied. Can you update it so that the formatting it not copied and only the data is copied over?

Thanks!

0
Ivan Danchev
Telerik team
answered on 29 Aug 2017, 08:58 AM
Hi Marc,

We do not have a different workaround for that missing feature, but the one I linked works as expected at my end. Here's a short screencast showing only the data being pasted, while formatting  (the cells background color for instance) not being pasted.

Regards,
Ivan Danchev
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Marc
Top achievements
Rank 1
answered on 29 Aug 2017, 09:00 AM

Hi Ivan,

It works in your example yes, but if you copy that onto a cell that is already formatted then it will remove the formatting that is currently there.

This is the behaviour I'm looking for - ie, a ctrl+c - ctrl+v only copies the cell value.

Thanks!

0
Ivan Danchev
Telerik team
answered on 31 Aug 2017, 07:47 AM
Hi Marc,

Currently there isn't a reliable approach available that would prevent the formatting removal in the pasted cell. It could be done manually by setting the previous format to the cell after the content is pasted, but that would require calling multiple methods of the Range object for setting different formatting options (bold, textAlign, background, color, etc.). Here's an example which shows this with just two of the methods (background and textAlign):
var background = sheet.range(pasteRef).background();
var textAlign = sheet.range(pasteRef).textAlign();

sheet.range(pasteRef).background(background)
sheet.range(pasteRef).textAlign(textAlign);

Copy a cell's content from a column and paste it in a cell in another column: the original background and text alignment are persisted in the pasted cell.


Regards,
Ivan Danchev
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Marc
Top achievements
Rank 1
answered on 31 Aug 2017, 09:24 AM

Hi Ivan,

This is great thanks!

Just an FYI - you can chain the calls like so (to avoid multiple references to the range):

sheet.range(pasteRef)

     .background(background)
     .textAlign(textAlign);

0
Ivan Danchev
Telerik team
answered on 04 Sep 2017, 06:28 AM
Hi Marc,

We are glad the suggested approach worked out. We are aware of the methods chaining option, which would be reasonable to use, especially if there are calls to multiple methods.

Regards,
Ivan Danchev
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Marc
Top achievements
Rank 1
answered on 04 Sep 2017, 06:41 AM

Hi Ivan,

Thanks again - impressed as always with the support I get here1

Marc

 

0
Trent
Top achievements
Rank 1
answered on 12 Sep 2018, 08:23 PM
I had this fix in place, it worked perfectly. However when I upgraded to 2018 R3 today this fix broke. 

http://dojo.telerik.com/eLUxIgEN
0
Ivan Danchev
Telerik team
answered on 14 Sep 2018, 04:02 PM
Hello,

The previously suggested workaround depended on logic that has changed in the last release along with the multiple Spreadsheet bug fixes included in this release (release history notes). An implementation of an option to choose whether only the value or value + formatting will be pasted, would remove the need for workarounds consisting of overriding the source code. It would ensure that subsequent changes (e.g. bug fixes) would not affect this functionality. Therefore we would suggest voting for the respective feature request in our Feedback Portal.  

Regards,
Ivan Danchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Trent
Top achievements
Rank 1
answered on 14 Sep 2018, 04:12 PM
Voting for that feature is all well and good. However since you still don't have that feature, is there another workaround I can use so that I can benefit from the bug fixes and still have this functionality now?
0
Ivan Danchev
Telerik team
answered on 18 Sep 2018, 08:20 AM
Hello,

Currently a workaround for the latest official version is not available. If we manage to come up with one we will post it both here and in the linked feature request in the Portal. 

Regards,
Ivan Danchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Spreadsheet
Asked by
Marc
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Marc
Top achievements
Rank 1
Trent
Top achievements
Rank 1
Share this question
or