Collapse the table of content
Expand the table of content


Last modified: June 14, 2011

Applies to: apps for SharePoint | SharePoint Server 2010

In this article
Return Value
Applies To

Gets the cell or range that is applicable to the event.

var value = Ewa.RangeEventArgs.getRange();

The Ewa.RangeEventArgs.getRange method returns the range that is associated with an event.

The following code example shows how to subscribe an event handler to the activeCellChanged event. The code also shows how to use Ewa.RangeEventArgs.getRange to get the range associated with the event.

<script type="text/javascript">

var ewa = null;

function ewaOnPageLoad()
    if (typeof (Ewa) != "undefined")
        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.

    // Add your code here.

// Handle the active cell changed event.
function cellChanged(rangeArgs)
    // Use the RangeEventArgs object to get information about the range.
    var sheetName = rangeArgs.getRange().getSheet().getName();
    var col = rangeArgs.getRange().getColumn();
    var row = rangeArgs.getRange().getRow();
    // Use getFormattedValues to return the value of the changed cell.
    var value = rangeArgs.getFormattedValues();
    alert("The active cell is located at row " + (row + 1) + " andcolumn " + (col + 1) + " with value " + value + ".");

    // Add your code here.
© 2016 Microsoft