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

text wrapping of the targeted cell while doing drag down and copy

2 Answers 23 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Iffat
Top achievements
Rank 1
Veteran
Iffat asked on 23 Feb 2021, 04:06 AM

Dear Telerik-kendo team,

I need a help for a particular functionality I am trying to achieve using kendo UI for jquery - spreadsheet. Currently I am facing two problems while trying to do drag down and copy cell values.

Here are the steps I was doing:

1. sheet.range("C1:C" + totalRowsCount).wrap(true);

2. Insert a really long text inside a C column's cell. The text wraps well as I wanted.

3. Hold the bottom right point of the cell and drag down.

4. Now the other cells got the upper cell's text, but text is not auto wrapped. (problem 1)

5. As encountering with problem 1, I tried a solution, that I tried to get the selection from range and set the selected cell's rowHeight onChange event. But in the selection() method, I am only able to access the top cell's information, not those cell's whose row height needs to be adjusted.(problem 2)

2 Answers, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 25 Feb 2021, 02:37 PM

Hello Iffat,

In order to wrap the text in the cell after it is filled in you could subscribe to the change event of the Spreadsheet. In the event handler, you could find the current range by using - 'e.range'. Then you could use the Range wrap method. Below is an example:

 change: function(e){         
          var spreadsheet = $("#spreadsheet").data("kendoSpreadsheet");
          var sheet = spreadsheet.activeSheet();
          sheet.range(e.range).wrap(true);
        },

You could use the e.range also to access the row index:

sheet.rowHeight(e.range._ref.topLeft.row, 200);

Here is a Dojo example where the content of a cell is wrapped after dragging. 

I hope you will find the provided information helpful.

Regards,
Neli
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Iffat
Top achievements
Rank 1
Veteran
answered on 25 Feb 2021, 09:41 PM
Thanks a lot! That fixes the problems I was having. I really appreciate your help :)
Tags
Spreadsheet
Asked by
Iffat
Top achievements
Rank 1
Veteran
Answers by
Neli
Telerik team
Iffat
Top achievements
Rank 1
Veteran
Share this question
or