At the beginning of the year, I wrote a little web app that lets you get embed code for REST URLs/elements in Excel Services in a very easy way – instead of crafting the URL yourself, or navigating through ATOM feeds, you get a nice UI to do that.
Well.. Not really “nice” as much as an “eye sore” – the HTML was pretty awful. I elicited the help of one of our PMs (Manpratap Suri) to make the application look and behave like somebody a sane person would want to use. Once installed, the first step is to select the workbook you want the embed code for:
The “Publish to web” option will show up, allowing the user to automatically navigate to the application page. Once clicked, the user is immediately dropped the application page:
There are five parts to this screen – at the top, there’s a huge “Publish to the web” title that should probably be made smaller. Then, below that, there are four elements you can choose from – charts, tables, PivotTables or ranges. To the left, below that, there’s a list of the available items (three items in the example above) and to the right is a preview image. Below the preview image, there are the available embed options – URL, HTML, Raw Data and DHTML.
The user can now easily navigate between the type of elements the workbook exposes and between the actual elements exposed and easily pick what they want to use in their site.
Clicking on “Tables” for example, will give the list of tables in the workbook:
The interesting part though is the “Embed” code at the bottom. There are four options:
* URL – this is the direct URL to the entity. Pasting this in the browser address box will directly navigate to the entity.
* HTML – this is the HTML that represents the element. For charts, this is an <img> tag with the appropriate link (which means it will be refreshed every time the page containing it is loaded). For ranges/PivotTables and Tables, this is the actual HTML for the object (which means that it is “static” – it will not change).
* DHTML – Only works for Ranges/PivotTables/Tables – this is is a piece of script and HTML that can be embedded – it will return the HTML for the requested element. Because this is brought in via AJAX every time the page loads, the data will always be current.
* Raw Data – Only works for Ranges/PivotTables/Tables – this is the link to the raw data (values) of the requested element.
In the next post, I am going to show how to use the various Embed options in SharePoint.