Ewa.WorkbookEventArgs Object

Last modified: October 05, 2012

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

Represents the workbook event arguments.

Ewa.WorkbookEventArgs

[Ewa.WorkbookEventArgs] enables you to get a reference to the workbook associated with the event.

The following code example shows how to subscribe an event handler to the gridSynchronized event. The code then uses the [Ewa.WorkbookEventArgs] object to get information about the associated workbook. The code example assumes that you are working with an Excel Web Access Web Part on SharePoint Server 2013.

var ewa = null;

// Add event handler for onload.
if (window.attachEvent)
{
    window.attachEvent("onload", ewaOnPageLoad);
}

// Add event handler for applicationReady event.
function ewaOnPageLoad()
{
    if (typeof (Ewa) != "undefined")
    {
        Ewa.EwaControl.add_applicationReady(ewaApplicationReady);
    }
    else
    {
        alert("Error - the EWA JS is not loaded.");
    }
}

function ewaApplicationReady()
{
    ewa = Ewa.EwaControl.getInstances().getItem(0);

    // Add event handler for gridSynchronized event.
    ewa.add_gridSynchronized(gridSync);
}

// Handle gridSynchronized event.
function gridSync(workbookEventArgs)
{
    alert(workbookEventArgs.getWorkbook().getActiveSelection().getAddressA1());
}

Show: