SharePoint 2013

Last modified: October 05, 2012

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

In this article
Return Value

Gets the Ewa.EwaControl object that represents the embedded Microsoft Excel workbook on the host page or the Excel Web Access Web Part on the SharePoint Server 2013 page.

var value = Ewa.RangeChangeEventArgs.getEwaControl();

The Ewa.RangeChangeEventArgs object is passed as an argument to the callback specified in the asynchronous method call. The [RangeChangeEventArgs.getEwaControl] method enables you to get a reference to associated [Ewa.EwaControl] object.

The following code example subscribes an event handler to the dataEntered event. When the specified event handler for the dataEntered event is invoked, it is invoked with a single argument of type Ewa.RangeChangeEventArgs. The Ewa.RangeChangeEventArgs object contains information about the Ewa.Range object associated with the dataEntered event.

The code example then shows how to use the [Ewa.RangeChangeEventArgs] object to get a reference to the [Ewa.EwaControl] object associated with the dataEntered event. The code example assumes that you are working with Excel Web Access Web Parts on SharePoint Server 2013.

<script type="text/javascript">
var ewa = null;

// Run the Excel load handler on page load
if (window.attachEvent) {
    window.attachEvent("onload", loadEwaOnPageLoad);
} else {
    window.addEventListener("DOMContentLoaded", loadEwaOnPageLoad, false);

// Event handler for page load event 
function loadEwaOnPageLoad() {
    if (typeof (Ewa) != "undefined") {
        // Retrieve workbook from SharePoint location when EWA is ready
    else {
        alert("Error - the EWA is not loaded.");
    // ...

function ewaApplicationReady() {
    // Get a reference to the EWA web part that represents the Ewa web part
    // in SharePoint:
    ewa = Ewa.EwaControl.getInstances().getItem(0);

    var sheets = ewa.getActiveWorkbook().getSheets();
    var sheet;

    // Add the event handler to every sheet in the workbook
    for (i = 0; i < sheets.getCount(); i++) {
        sheet = sheets.getItem(i);

function sheetDataEnteredHandler(rangeChangeArgs) {
    var ewa2 = rangeChangeArgs.getEwaControl();
          // …