SpreadJS Documentation
Getting the Cell Position and Size

You can get the location and size of specific cells.

Using Code

This example gets the cell location and size.

JavaScript
Copy Code
$("#ss").data("spread").getActiveSheet().bind(GcSpread.Sheets.Events.CellClick, function (e, info) {
    if(info.sheetArea ===GcSpread.Sheets.SheetArea.viewport){
        console.log("Clicked cell index (" + info.row + "," + info.col + ")");

        //Acquire the coordinate information of regular cells which exist at the specified index position
        var cellRect = $("#ss").data("spread").getActiveSheet().getCellRect(info.row, info.col);
        console.log("X coordinate:" + cellRect.x);
        console.log("Y coordinate:" + cellRect.y);
        console.log("Cell width:" + cellRect.width);
        console.log("Cell height:" + cellRect.height);
    }
});

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.