Share via


Ewa.RangeEventArgs.getFormattedValues()

Applies to: apps for SharePoint | SharePoint Server 2010

In this article
Return Type
Remarks
Example
Applies To

Gets the two-dimensional object that contains the formatted values for the cell or range that is associated with the given event.

var value = Ewa.RangeEventArgs.getFormattedValues();

Return Type

Object array

Remarks

The Ewa.RangeEventArgs.getFormattedValues method returns a two-dimensional object array that contains formatted values that are in the specified range. Ewa.RangeEventArgs.getFormattedValues returns null if some or all of the values are not already loaded by the Excel Services Web Part.

Example

The following code example shows how to subscribe an event handler to the activeCellChanged event. The code also shows how to use Ewa.RangeEventArgs.getFormattedValues to get the formatted value of the specified cell.

<script type="text/javascript">

var ewa = null;

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 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.

}
</script> 

Applies To

Ewa.RangeEventArgs Object

See Also

Reference

Ewa.RangeEventArgs Methods

Concepts

Ewa Namespace