Microsoft Office Tutorials and References
In Depth Information
Excel Services and ECMAScript
You can use JSOM to retrieve data from sheets, tables, PivotTables, chart, and cells or a range of cells. You can subscribe
to many events in order to handle various user actions, such as active selection changed or cell value editing.
JSOM is very simple to use. All you need is to write some JavaScript and add it to the page either directly or by
using the Content Editor Web Part. The JSOM classes and members are available in the EwaMoss.js file located in the
%ProgramFiles%\Common Files\Microsoft Shared\Web server extensions\15\template\layouts directory.
reference to ewaMoss.js, by default, is available in the default master page. You need to refer to the file when
custom master pages are designed.
Let’s now see how to use JSOM to retrieve data from an Excel workbook that is published to SharePoint 2013.
prOBLeM CaSe
retrieve a selected range of cell values, and display them on the page using the JavaScript Object Model. Use the
excel workbook you created using SSaS data earlier in this chapter.
You’ve already performed a similar kind of exercise earlier in Chapter 2 to retrieve the data. We will follow the
same methodology to retrieve data from the excel workbook in this case. the major steps involved in this exercise
are as follows:
First, add the page-load event handler:
window.attachEvent("onload", Page_Load);
On page load, create a delegate method for “applicationready” event. as soon as the excel
Services JavaScript Object Model is ready, this delegate method will be called:
When the delegate method is called, get the instance of the excel Web part on the page. in
the code, index 0 is used with the expectation that only one instance of the eWa Web part
is available:
ewaWebPart = Ewa.EwaControl.getInstances().getItem(0);
verify whether the instance of eWa is available, and add the ActiveSelectionChanged event
handler to the excel Web access Web part instance:
Search JabSto ::

Custom Search