Share via


Ewa.Range.getRowCount()

Applies to: apps for SharePoint | Excel Services | SharePoint Server 2013

In this article
Return Value
Remarks
Example
Applies To

Gets the number of rows.

var value = Ewa.Range.getRowCount();

Return Value

Type: int

Remarks

The Ewa.Range.getRowCount method returns an integer value that represents the number of rows in the specified range.

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 number of rows in the selected range in the browser status bar. The code example assumes that you are working with Excel Web Access Web Parts on SharePoint Server 2013.

<script type="text/javascript">
 
var ewa = null;
 
// Add event handler for onload event.
if (window.attachEvent) 
{ 
    window.attachEvent("onload", ewaOnPageLoad);    
} 
else 
{ 
    window.addEventListener("DOMContentLoaded", ewaOnPageLoad, false); 
}

// Add event handler for applicationReady event.
function ewaOnPageLoad() 
{ 
Ewa.EwaControl.add_applicationReady(onApplicationReady); 
} 

function onApplicationReady()
{        
    // Get a reference to the Excel Services Web Part.
    ewa = Ewa.EwaControl.getInstances().getItem(0);                                     
}  

function getRangeRowCountButton()
{
    // Get the active range.
    var range = ewa.getActiveWorkbook().getActiveSelection();
    
    if (range != null)
    {
    // Display range row count.
    window.status = "Number of rows in range: " + range.getRowCount(); 
    }    
    else
    {
       alert("No range selected.");
    }    
}            

</script>
<input type="button" id="ShowRangeRowCount" value="Show Range Row Count" onclick="getRangeRowCountButton()" />

Applies To

Ewa.Range Object

See also

Concepts

Ewa.Range Methods

Ewa namespace