Range Copy Paste

14 posts, 1 answers
  1. Marc
    Marc avatar
    171 posts
    Member since:
    Sep 2016

    Posted 11 Aug 2017 Link to this post

    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

  2. Answer
    Ivan Danchev
    Admin
    Ivan Danchev avatar
    2093 posts

    Posted 15 Aug 2017 Link to this post

    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.
  3. Marc
    Marc avatar
    171 posts
    Member since:
    Sep 2016

    Posted 15 Aug 2017 in reply to Ivan Danchev Link to this post

    Hi Ivan!

    This is great, thanks so much!

  4. Marc
    Marc avatar
    171 posts
    Member since:
    Sep 2016

    Posted 26 Aug 2017 Link to this post

    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!

  5. Ivan Danchev
    Admin
    Ivan Danchev avatar
    2093 posts

    Posted 29 Aug 2017 Link to this post

    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.
  6. Marc
    Marc avatar
    171 posts
    Member since:
    Sep 2016

    Posted 29 Aug 2017 in reply to Ivan Danchev Link to this post

    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!

  7. Ivan Danchev
    Admin
    Ivan Danchev avatar
    2093 posts

    Posted 31 Aug 2017 Link to this post

    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.
  8. Marc
    Marc avatar
    171 posts
    Member since:
    Sep 2016

    Posted 31 Aug 2017 in reply to Ivan Danchev Link to this post

    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);

  9. Ivan Danchev
    Admin
    Ivan Danchev avatar
    2093 posts

    Posted 04 Sep 2017 Link to this post

    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.
  10. Marc
    Marc avatar
    171 posts
    Member since:
    Sep 2016

    Posted 04 Sep 2017 in reply to Ivan Danchev Link to this post

    Hi Ivan,

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

    Marc

     

  11. Trent
    Trent avatar
    3 posts
    Member since:
    Feb 2018

    Posted 12 Sep 2018 Link to this post

    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
  12. Ivan Danchev
    Admin
    Ivan Danchev avatar
    2093 posts

    Posted 14 Sep 2018 Link to this post

    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.
  13. Trent
    Trent avatar
    3 posts
    Member since:
    Feb 2018

    Posted 14 Sep 2018 in reply to Ivan Danchev Link to this post

    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?
  14. Ivan Danchev
    Admin
    Ivan Danchev avatar
    2093 posts

    Posted 18 Sep 2018 Link to this post

    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.
Back to Top