Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
recalcAsync(callback, userContext)

Ewa.Workbook.recalcAsync(callback, userContext)

Last modified: June 14, 2011

Applies to: apps for SharePoint | SharePoint Server 2010

In this article
Return Value

Calculates the workbook.

Ewa.Workbook.recalcAsync(callback, userContext);


The function that is called when the request is complete.


An object provided as a way for callers to pass state through the asynchronous call.

The Ewa.Workbook.recalcAsync calculates the specified workbook. Ewa.Workbook.recalcAsync has the same effect as calculating the workbook.

The following code example shows how to add a button to the page and then adds an event handler to the button onClick event that recalculates the workbook and then displays the success of the recalculation in the browser status bar.

<script type="text/javascript">
var ewa = null;
// Add event handler for onload event.
if (window.attachEvent) 
    window.attachEvent("onload", ewaOmPageLoad);    
    window.addEventListener("DOMContentLoaded", ewaOmPageLoad, false); 

// Add event handler for applicationReady event.
function ewaOmPageLoad() 

function getEwa()
    // Get a reference to the Excel Services Web Part.
    ewa = Ewa.EwaControl.getInstances().getItem(0);                                     

function recalcAsyncButton()
    // Recalculate workbook.

function recalcAsyncCallBack(asyncResult)
    // Get the value from asyncResult if the asynchronous operation was successful.
    if (asyncResult.getCode() == 0)
        // Display recalculate success message.
        window.status = "Workbook recalculation successful!";
         alert("Operation failed with error message " + asyncResult.getDescription() + ".");

<input type="button" id="RecalcWorkbook" value="Calculate Workbook" onclick="recalcAsyncButton()" />
© 2015 Microsoft