Share via


Ewa.Workbook.reloadWorkbookAsync(callback, userContext)

Applies to: apps for SharePoint | Excel Services | SharePoint Server 2013

Reloads the workbook.

Ewa.Workbook.reloadWorkbookAsync(callback, userContext);

Parameters

callback

The function that is called when the request is complete.

userContext

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

Remarks

The [Ewa.Workbook.reloadWorkbookAsync] reloads the specified workbook from its in-memory state, which discards any changes the end user may have made. [Ewa.Workbook.reloadWorkbookAsync] has the same effect as clicking Reload Workbook when interacting with the workbook in an Excel Web Access Web part.

Note

Calling [Ewa.Workbook.reloadWorkbookAsync] will generate a new session ID for the associated Ewa.EwaControl Objectobject.

Example

The following code example assumes that you have created a web page that lets visitors play a game of chess. The page hosts an Excel Web Access Web Part and uses it to display the game board. The example code assumes all of the necessary initialization, etc., etc., has already occurred. The code is an implementation of the "reset game board function," which resets each piece to its starting position, i.e., the initial state stored in the underlying workbook, and informs the user how many pieces have been reset. The code example shows the game board reset function, which uses the [Ewa.Workbook.reloadWorkbookAsync] method.

function resetGameBoard() {
    var currentWorkbook = ExtractPieceLocations(gameBoardWb.getActiveWorkbook());
    gameBoardWb.reloadWorkbookAsync(gameIsReset, currentWorkbook);
}

See also

Reference

Ewa.Workbook Object