Ewa.EwaControlCollection Object
Applies to: apps for SharePoint | SharePoint Server 2010
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.
<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);
}
else
{
window.addEventListener("DOMContentLoaded", ewaOmPageLoad, false);
}
// Add an event handler for the applicationReady event.
function ewaOmPageLoad ()
{
Ewa.EwaControl.add_applicationReady(GetEwa);
}
// Attach to the individual Excel Web Access (EWA) web parts.
function GetEwa()
{
EWA1 = Ewa.EwaControl.getInstances().getItem(0);EWA2 = Ewa.EwaControl.getInstances().getItem(1);
// Add your code here.
}
</script>