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

How to differentiate between pasted data (Copied from other spreadsheet) and manually written data in kendo spreadsheet.

3 Answers 87 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Partha Pratim
Top achievements
Rank 1
Partha Pratim asked on 08 Jun 2017, 05:33 AM
We need to do some format change operation only for pasted data which is copied from other spreadsheet. That format change is not applicable for manually written data  We have tried to distinguish pasted data from manually written data in 'Change' event of spreadsheet but could not find any clue.

3 Answers, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 08 Jun 2017, 07:45 AM
Hello,

There isn't a built-in method that allows to differentiate pasted from typed data. You could use jQuery to detect pasting in the Spreadsheet, then get the selected range and format it. See this dojo for 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
Partha Pratim
Top achievements
Rank 1
answered on 15 Jun 2017, 05:44 AM
Thanks Ivan for your reply. But I think there is a problem with selection() method of sheet. It actually returns single row and single column though there are multiple selected rows and columns present. That's why only first cell is getting updated instead of every rows and columns. Please refer to the screenshot of the dojo. 
0
Veselin Tsvetanov
Telerik team
answered on 16 Jun 2017, 11:43 AM
Hi,

You are correct, that the selection() method in this scenario would return only the top-left pasted cell. In order to cover the case with pasting multiple cells, I would suggest you to implement a handler for the change event:
change: function(e) {
  setTimeout(function() {
    if (isPasted) {
      isPasted = false;
       
      var changedRange = e.range;
      changedRange.background("lightgreen");
    }
  }, 0);
},

and alter the paste handler implementation to:
$('.k-spreadsheet').on('paste', function () {
  isPasted = true
});

Here you will find a modified version of the Dojo, which implements the above suggestion.

Regards,
Veselin Tsvetanov
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.
Tags
Spreadsheet
Asked by
Partha Pratim
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Partha Pratim
Top achievements
Rank 1
Veselin Tsvetanov
Telerik team
Share this question
or