Ewa.Range.getRow()
Applies to: apps for SharePoint | SharePoint Server 2010
In this article
Return Value
Remarks
Example
Applies To
Gets the row position on the zero-based grid.
var value = Ewa.Range.getRow();
Return Value
int
Remarks
The Ewa.Range.getRow method returns an integer value that represents the row position of the specified range. The row position is determined by the top-leftmost cell in the range and is zero-based; that is, row "1" is 0, row "2" is 1, and so on.
Example
The following code example shows how to add a button to the page and then adds an event handler to the button onClick event that displays the row position of the selected range in the browser status bar.
<script type="text/javascript">
var ewa = null;
// Add event handler for onload event.
if (window.attachEvent)
{
window.attachEvent("onload", ewaOmPageLoad);
}
else
{
window.addEventListener("DOMContentLoaded", ewaOmPageLoad, false);
}
// Add event handler for applicationReady event.
function ewaOmPageLoad()
{
Ewa.EwaControl.add_applicationReady(getEwa);
}
function getEwa()
{
// Get a reference to the Excel Services Web Part.
ewa = Ewa.EwaControl.getInstances().getItem(0);
}
function getRangeRowButton()
{
// Get the active range.
var range = ewa.getActiveWorkbook().getActiveSelection();
if (range != null)
{
// Display range row number.
window.status = "Row number of range: " + range.getRow();
}
else
{
alert("No range selected.");
}
}
</script>
<input type="button" id="ShowRangeRow" value="Show Range Row" onclick="getRangeRowButton()" />