Ewa.EwaControl Object

Last modified: October 03, 2012

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

Represents the Excel Services Web Part on the page.

Ewa.EwaControl

The Ewa.EwaControl object represents an Excel Services Web Part. In the Excel Services API, all other objects in the API are accessed through the Ewa.EwaControl object.

For more information about the Excel Services Web Part, see Excel Web Access in the SharePoint Server 2010 SDK documentation.

The following code example shows how to get a reference to an Excel Services Web Part. 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 is not loaded.");
    }
    // Add your code here.
}

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

    // Add your code here.
}

// Add your code here.
    </script>
Show: