SpreadJS Documentation
getCellRect Method
The row index.
The column index.
Index of the row of the viewport: -1 represents column header area, 0 represents frozen row area, 1 represents viewport area, 2 represents trailing frozen row area.
Index of the column of the viewport: -1 represents row header area, 0 represents frozen column area, 1 represents viewport area, 2 represents trailing frozen column area.
Gets the rectangle of the cell.
Syntax
var instance = new GcSpread.Sheets.Sheet(name);
var value; // Type: Rect
value = instance.getCellRect(row, col, rowViewportIndex, colViewportIndex);
function getCellRect( 
   row : number,
   col : number,
   rowViewportIndex : number,
   colViewportIndex : number
) : Rect;

Parameters

row
The row index.
col
The column index.
rowViewportIndex
Index of the row of the viewport: -1 represents column header area, 0 represents frozen row area, 1 represents viewport area, 2 represents trailing frozen row area.
colViewportIndex
Index of the column of the viewport: -1 represents row header area, 0 represents frozen column area, 1 represents viewport area, 2 represents trailing frozen column area.

Return Value

Object that contains the size and location of the cell rectangle.
Example
This example uses the getCellRect method.
$("#spreadContainer").data("spread").getActiveSheet().bind(GcSpread.Sheets.Events.CellClick, function (e, info) {
    if(info.sheetArea === GcSpread.Sheets.SheetArea.viewport){
        alert("Clicked cell index (" + info.row + "," + info.col + ")");

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

Reference

Sheet type

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.