Spread.Sheets Documentation
getViewportTopRow Method
GC.Spread.Sheets Namespace > Worksheet type : getViewportTopRow Method
The index of the viewport.
Gets the index of the top row in the viewport.
Syntax
var instance = new GC.Spread.Sheets.Worksheet(name);
var value; // Type: number
value = instance.getViewportTopRow(rowViewportIndex);
function getViewportTopRow( 
   rowViewportIndex : number
) : number;

Parameters

rowViewportIndex
The index of the viewport.

Return Value

The index of the top row in the viewport.
Example
This example uses the getViewportTopRow method.
$("#button1").click(function () {  
    //Acquire top row (column) index
    var topRow = activeSheet.getViewportTopRow(1);
    var leftCol = activeSheet.getViewportLeftColumn(1);
    alert("Index of top row being displayed: " + topRow + "\n" +
        "Index of first column being displayed: " + leftCol);
});

//Add button control to page
<input type="button" id="button1" value="button1"/>
This example returns the indices for the bottom and top rows and left and right columns in the current sheet view.
var brow = activeSheet.getViewportBottomRow(1);
var lcol = activeSheet.getViewportLeftColumn(1);
var rcol = activeSheet.getViewportRightColumn(1);
var trow = activeSheet.getViewportTopRow(1);
alert(brow);
alert(lcol);
alert(rcol);
alert(trow);
Remarks

If there are frozen and trailing frozen columns and rows, then the  viewport area is split into 9 areas (3 rows and 3 columns). The parameter for the method only takes effect when the sheet has frozen rows or columns.

Sheet.getViewportTopRow(2) means get the trailing viewport top row index. If there is no trailing frozen line, the top row index should be the last row index of viewport 1.

See Also

Reference

Worksheet type