Spread.Sheets Documentation
Getting Selected Ranges

You can get the ranges of multiple selected areas.

Using Code

This example gets the selected ranges.

JavaScript
Copy Code

window.onload = function(){
          var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount:3});
          var activeSheet = spread.getActiveSheet();
activeSheet.setRowCount(5);
activeSheet.setColumnCount(5);

$("#button1").click(function(){        
//Acquiring selection ranges
 var selectedRanges = spread.getActiveSheet().getSelections();

         for(var i = 0; i < selectedRanges.length; i++){
             console.log("---------------------------------------------");
             console.log("Using Range class");
             console.log("---------------------------------------------");
             console.log("Selected top row index: " + selectedRanges[i].row);
             console.log("Number of selected rows: " + selectedRanges[i].rowCount);
             console.log("Selected first column index: " + selectedRanges[i].col);
             console.log("Number of selected columns: " + selectedRanges[i].colCount);
         }
     });

}

See Also

Developer's Guide

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.