Ewa.RangeEventArgs.getWorkbook()

Applies to: apps for SharePoint | SharePoint Server 2010

In this article
Return Value
Remarks
Example
Applies To

Gets the workbook object that is applicable to the event.

var value = Ewa.RangeEventArgs.getWorkbook();

Return Value

workbook

Remarks

The Ewa.RangeEventArgs. getWorkbook method returns the workbook that contains the range that is associated with a given event.

Example

The following code example shows how to get a reference to the workbook associated with the event using the EwaControl.getActiveWorkbook method when the activeCellChanged event is raised and then displays the location of the active cell in A1 format in the browser status bar using the Ewa.Workbook.getActiveCell.

<script type="text/javascript">

var ewa = null;

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

    if (window.attachEvent)
    {
        window.attachEvent("onload", ewaOnPageLoad);
    }


function ewaOnPageLoad()
{
    if (typeof (Ewa) != "undefined")
    {
        Ewa.EwaControl.add_applicationReady(ewaApplicationReady);
    }
    else
    {
        alert("Error - the EWA JS 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 an event handler for the 
    // active cell changed event.
    ewa.add_activeCellChanged(cellChanged);

    // Add your code here.
    
    
}

// Handle the active cell changed event.
function cellChanged(rangeArgs)
{
    
    // Use the RangeEventArgs object to get information about the active cell.
    var activeCellLocation = rangeArgs.getWorkbook().getActiveCell().getAddressA1();
    
    // Display active cell location in browser status bar.
    window.status = "Active cell currently located at " + activeCellLocation + ".";

    // Add your code here.
}
</script>

Applies To

Ewa.RangeEventArgs Object

See Also

Reference

Ewa.RangeEventArgs Methods

Concepts

Ewa Namespace