Using the Excel Services JSOM
Table 1 lists the difference between the two scenarios available when you write code that uses the JSOM.
Table 1. Scenarios for Excel Services JSOM
||In this scenario, you embed a workbook that is stored on OneDrive into the host webpage using an HTML
element. Then you include code in the page that interacts with the embedded workbook.
||In this scenario, you have a SharePoint page served by SharePoint. You insert an Web Part into the SharePoint page that contains a workbook that is stored in an trusted location. Then you include code in the SharePoint page that interacts with the Web Part.
Getting a reference to the EwaControl object (SharePoint)
When writing code that interacts with an Web Part on a SharePoint page, you get a reference to the [Ewa.EwaControl] object by using the method, Ewa.EwaControlCollection.getItem(index), as shown in the following code example.
Getting a reference to the EwaControl object (OneDrive)
When writing code that interacts with an embedded workbook that is stored on OneDrive, you get a reference to the [Ewa.EwaControl] object through the AsyncResult object. The [AsyncResult] object is passed in as the single parameter to the callback method that you specify in the Ewa.EwaControl.loadEwaAsync static method. When the callback is invoked, a reference to the [Ewa.EwaControl] object is included in the [AsyncResult] object. The following code example shows how you get a reference to the [Ewa.EwaControl] object through the [AsyncResult] object.