Ewa.EwaControlCollection Object

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

Represents the collection of the Excel Web Access Web Part instances on a page.

Ewa.EwaControlCollection

Remarks

The Ewa.EwaControlCollection object represents the collection of the Excel Web Access Web Part instances on a page. Use the Ewa.EwaControl.getInstances() method to get a reference to the EwaControlCollection.

Important

The Excel Web Access Web Part instances in the Ewa.EwaControlCollection object will not necessarily to be in any specific order. To obtain a reference to a specific instance, use one of several types of unique information about the Excel Web Access Web Part.

For example, you could use the workbook path, Session ID, or Edit/View mode associated with the Excel Web Access Web Part to locate a specific instance.

Example

The following code example shows how to use the EwaControl.getInstances static method to get a reference to the collection of Excel Web Access Web Parts on the page and then uses the Ewa.EwaControlCollection.getItem(index) method get a separate reference to each of the two Excel Web Access Web Parts on the page. The code example assumes that you are working with Excel Web Access Web Parts on SharePoint Server 2013.

<script type="text/javascript">

// Initialize variables.
var EWA1 = null;
var EWA2 = null;
    
// Add event handler for onload event.
if (window.attachEvent) 
{ 
    window.attachEvent("onload", ewaOnPageLoad);    
} 
else 
{ 
    window.addEventListener("DOMContentLoaded", ewaOnPageLoad, false); 
}

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

// Attach to the individual Excel Web Access (EWA) web parts.
function onApplicationReady()
{
    EWA1 = Ewa.EwaControl.getInstances().getItem(0);EWA2 = Ewa.EwaControl.getInstances().getItem(1);

    // Add your code here.
} 
</script>

See also

Concepts

Ewa.EwaControlCollection Methods