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

How to get the cells' value of the selected range?

7 Answers 1885 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
ltxx
Top achievements
Rank 1
ltxx asked on 19 Nov 2015, 06:26 AM
How to get the cells' value of the selected range? please give the example, thanks!

7 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 20 Nov 2015, 03:47 PM
Hi,

The first step would be to create a Range using the sheet's current selection. Once you have that you can extract the Range's cell values, for example:  
var sheet = spreadsheet.activeSheet();
var range = sheet.selection();
var values = range.values();

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
ltxx
Top achievements
Rank 1
answered on 23 Nov 2015, 06:16 AM

Thanks for your help! I have an another question.

Given the number of rows and columns, how can I get the selection "range"? because the column No is 'A','B',.....

Now, I can get the selection range by using:

1.sheet.range("A1:B3")

Is there a function for getting the selection range directely,given the number of rows and columns?

0
Alexander Popov
Telerik team
answered on 25 Nov 2015, 08:14 AM
Hello,

As stated in the documentation, the range method also supports the RC notation, where both the row and the column can be referred by numbers.

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
ltxx
Top achievements
Rank 1
answered on 26 Nov 2015, 01:52 AM
[quote]Alexander Popov said:Hello,

As stated in the documentation, the range method also supports the RC notation, where both the row and the column can be referred by numbers.

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 

[/quote]

Hi,

 As you say, the range method of the spreadsheet support RC notation, however it seems not to be working as my expected. Can you give an example for me? My code is as follows:

var spreadsheet = $("#spreadsheet").data("kendoSpreadsheet");
var sheet = spreadsheet.activeSheet();
var range = sheet.range("R4C5"); //4 rows and 5 columns,A1:E4

//var range = sheet.range("A1:E4"); //OK

 var values = range.values(); 

0
Alexander Popov
Telerik team
answered on 27 Nov 2015, 02:37 PM
Hello,

I apologize for misleading you. Indeed, the RC notation is currently not working as expected, which is something we will investigate. Meanwhile you can use the range method by passing the starting row and column, as well as the desired number of rows and column to be included. For example: 
//create a range between A1 and E4:
var startingRow = 0; //zero-based
var startingCol = 0;
var rows = 4;
var cols = 5;
 
var range = spreadsheet.activeSheet().range(startingRow, startingCol, rows, cols);
spreadsheet.activeSheet().select(range._ref);


Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
chandan
Top achievements
Rank 1
answered on 04 Oct 2016, 11:29 AM

[quote]Alexander Popov said:Hello,

I apologize for misleading you. Indeed, the RC notation is currently not working as expected, which is something we will investigate. Meanwhile you can use the range method by passing the starting row and column, as well as the desired number of rows and column to be included. For example: 

//create a range between A1 and E4:
var startingRow = 0; //zero-based
var startingCol = 0;
var rows = 4;
var cols = 5;
 
var range = spreadsheet.activeSheet().range(startingRow, startingCol, rows, cols);
spreadsheet.activeSheet().select(range._ref);


Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
[/quote]How to customise row and column header in kendo spreadsheet 

Is there any Cell template is available for kendo spreadsheet

0
Alexander Popov
Telerik team
answered on 06 Oct 2016, 08:39 AM
Hello chandan,

I am afraid customizing the the Spreadsheet's column and row headers is not supported by design, thus the lack of any templates. 

Regards,
Alexander Popov
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
Tags
Spreadsheet
Asked by
ltxx
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
ltxx
Top achievements
Rank 1
chandan
Top achievements
Rank 1
Share this question
or