We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Get selected range(s) in a spreadsheet control

Hi,

I create a spreadsheet control ("SC") in a dialog to show the content of an Excel file. I would like upon closing the dialog to get the selected range of cells in the current sheet.

I found the property SC.ExcelProperties.CurrentExcelRangeStyle which seems to correspond to what I want, but it does not seem to work when I select multiple ranges in the spreadsheet control (using Ctrl and the mouse). Is there a way to get a multiple selection of ranges, or a list of selected ranges? If it is not possible, can I at least deactivate multi-select in the control so that my users do not believe that it is possible to select non contiguous ranges?

Best regards
Hervé





1 Reply

JS Jayapradha S Syncfusion Team December 17, 2013 12:47 PM UTC

Hi Herve,

 

Thanks for using Syncfusion products.

 

We have analyzed your query. You can get the Selected ranges in spreadsheet control by using SelectedRanges property in GridModel as in the below code snippet,

Code Snippet:

void Button_Click(object sender, RoutedEventArgs e)

        {

            var model = this.spreadsheetControl.GridProperties.CurrentExcelGridModel;

           //you can get the multiple selected ranges from below code

            var ranges = model.SelectedRanges;

    

        }

 

Please download the sample from the below location,

 

Sample Link:

SpreadsheetDemo_WPF.zip

 

Please let us know if this helps.

 

Regards,

Jayapradha


Loader.
Live Chat Icon For mobile
Up arrow icon