Ewa.EwaControlCollection.getCount()

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

In this article
Return Value
Remarks
Example
Applies To

Gets the count of the Excel Web Access Web Part instances on the page.

var value = Ewa.EwaControlCollection.getCount();

Return Value

Integer

Remarks

The [EwaControlCollection.getCount] method returns the number of Excel Web Access Web Part instances on the page.

Example

The following code example shows how to return the count of all Excel Web Access Web Part instances on the page. The code example assumes that you are working with an Excel Web Access Web Part 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()
{
    if (typeof (Ewa) != "undefined")
    {
        Ewa.EwaControl.add_applicationReady(ewaApplicationReady);
    }
    else
    {
        alert("Error - the EWA JS is not loaded.");
    }
}

function ewaApplicationReady()
{
    // Get count of all EWA instances.
    alert(Ewa.EwaControl.getInstances().getCount());
}

</script>

Applies To

Ewa.EwaControlCollection Object

See also

Concepts

Ewa.EwaControlCollection Methods

Ewa namespace