Export (0) Print
Expand All


Last modified: June 08, 2011

Applies to: apps for SharePoint | SharePoint Server 2010

In this article
Return Value
Applies To

Gets the EwaControlCollection object with EwaControl instances that can be used.

var value = Ewa.EwaControl.getInstances();

[EwaControl.getInstances] is a static method of the EwaControl class that returns the EwaControlCollection for the page.

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.

<script type="text/javascript">

// Initialize variables.
var EWA1 = null;
var EWA2 = null;

// Add event handler for onload event.
if (window.attachEvent) 
    window.attachEvent("onload", ewaOmPageLoad);    
    window.addEventListener("DOMContentLoaded", ewaOmPageLoad, false); 

// Set page event handlers for onload, proceed to the PageLoad function defined below once the page has loaded if (window.attachEvent){
    window.attachEvent("onload", PageLoad);

// Add an event handler for the applicationReady event.
function PageLoad()

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

    // ...


© 2015 Microsoft