Ewa.RangeEventArgs Object
Applies to: apps for SharePoint | Excel Services | SharePoint Server 2013
Represents range event arguments for a given range event.
Ewa.RangeEventArgs
Remarks
[Ewa.RangeEventArgs] contains information about the range that triggered the event. Use the methods of the [Ewa.RangeEventArgs] object to get the values of the cells in the range, to get a reference to the range itself, or to get a reference to the workbook that contains the range.
Example
The following code example shows how to subscribe an event handler to the activeCellChanged event. The code then shows how to use the [Ewa.RangeEventArgs] to get information about the specified range. The code example assumes that you are working with an Excel Web Access Web Part 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", ewaOnPageLoad);
} else {
window.addEventListener("DOMContentLoaded", ewaOnPageLoad, false);
}
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();
var value = rangeArgs.getFormattedValues();
alert("The active cell is located at row " + (row + 1) + " and column " + (col + 1) + " with value " + value + ".");
// Add your code here.
}
</script>
See also
Other resources
Ewa.RangeEventArgs Members