It’s great that we now have a platform that can use an iFrame in Office documents, but we needed a key piece to interact with the document data to make apps for Office even more useful. Now we have the best of both worlds―the simplicity of web development and the richness of the best productivity applications―welcome Office.js!
The following are the key scenarios for Office.js.
- Visualizations: Visualizations is probably one of the most important scenarios for Office.js. Excel and Word already expose very cool out-of-the-box charts and smart art to interact with data, but they do not support all the possible ways to visualize data. A great example of visualization is the Bing Maps content app, capable of charting locations from a document into a map. What is required to creat a visualization? Well, at the minimum, linking to the data to be visualized (in order to read, write content) and subscribing to data and selection change events to refresh the chart. Also, highly desirable, is the capability of storing custom settings, such as the map mode, colors, etc. so that when the document is opened again, the app can restore them. Office.js enables these features.
- Contextual content and services: Provide relevant information when contextually needed, as well as enable end users to execute specific tasks as a result of it. This pattern is especially important in Outlook since many actions can be triggered as a result of receiving an e-mail, such as getting information from products, customers, etc. The LinkedIn app in Outlook is a great example of this. This app can have access to the email address details of the recipients of an e-mail so that end users can check their LinkedIn profiles and potentially add them as LinkedIn contacts!
- Data enhancement and analysis: Integrate intelligent services into Office documents, such as validating data against a master source (i.e. phone numbers or zip codes) or getting data from reliable data sources to enhance analysis in Office documents. A great example of this type of app is the “Election Tracker” template. This application gets data from a reliable source and inserts it into a table in Excel, and also offers a great way to visualize and analyze election poll data with a map capable of representing current and historic trends. Excel is and has been the premiere way of analyzing data today, and with apps for Office, it can only get better. Apps like this “Election tracker” require aggregating data into tables in Excel (from the polls) as well as binding and reacting to data additions on them in order to keep the map up to date.
- Reference & research: Enable users to search and use information from Encyclopedia Britannica, Bing Images, Webster dictionary, and many other services that are literally at your fingertips inside a Word, Excel, or PowerPoint document. You don’t need to switch to those sites to get and reuse the content you are looking for; you just need to get these apps on your task pane. Generally these apps need to identify when a user is making a selection in the document and reading the selection they made to search and find relevant content. Then after the app finds the content, users can reuse the content by inserting it on the current insertion point of the document as plain text or images, or in advanced cases, in Office Open XML, or HTML formats.
- Master/detail: This pattern is about providing rich information as a result of a user selection in a document. The Bing Finance app is a great example of a Master/Detail app. The app enables a user to create a portfolio of stocks on the task pane and then insert it as a table in Excel. The user can then select items on the table and the task pane will be refreshed with the latest news, quotes and details of the selected symbol. So basically, having a table in Excel, binding to it, reacting when a user is making a selection on that specific table, (not in any other part of the document J), and identifying the exact row where the user made the selection to read the data from it and update the app charts with the right country information.
- Document authoring: The pattern consists in providing document authoring assistance to create great documents, such as resumes, business proposals, etc. The Avery app is a nice example of how to simplify the creation of a Word document with pre-design templates that offer a “fill-in-the-blanks" experience. To print Avery labels at home, basically the user inserts the app, searches for the available label templates. Once he finds it, he inserts the template into the document. Office.js helps the developer here by enabling writing into the document. This operation can be as simple as writing just plain text or a table, or as rich as inserting HTML or Office Open XML (OOXML) formats to write literally any possible content into a Word document (tables, images, smart art, content controls and a big etc.). The Avery app actually took this capability to the limit by exposing their templates as OOXML with advanced document markup such as margins, images, text format, etc.
- Document publishing: This pattern is about publishing a complete document to a service provider such as a printing or a faxing service. Office.js enables two ways of getting the entire document (in Word and PowerPoint): 1) Apps that require access to the entire text of the document, and 2) Apps that require the entire document with 100% fidelity. A good example of the first type is the Pingar Summaries App which is an app for Word capable of creating a smart summary of the current document. This app really only needs access to the plain text of the document in order to output a summary, regardless of the formatting. The eFax app on the other hand, is a Word app that will Fax the current document to the specified fax numbers. This app does require to have access to the entire document with 100% fidelity.
Thanks for reading and happy coding!