JavaScript API for Office

An Office web add-in is a web application hosted inside a browser control that runs inside an Office application (desktop and online).
Add-ins can access information in the current document and connect to web services and other web-based resources.
An add-in is not installed on the host but has its implementation hosted on a web server.
Uses standard web technologies like HTML5, XML, CSS3, Javascript and REST APIs.


These are the versions of the Office.js javascript library.
Your add-in must include a reference to the office.js file.
Referencing the CDN (content delivery network) location means you do not have to deploy a copy of this file.
Your application will reference the office.js library.
The office.js library is a script loader that loads the object models that correspond to the office application.
This API consists of members of the Microsoft.Office.WebExtensions namespace
Office = Microsoft.Office.WebExtensions
Referenced by default using the alias Office

MSDN - Getting Started Articles


OfficeHelpers -
OfficeExtension -

Office 2016 API Model

The object model has stringly typed object orientated classes with similar methods and properties to those found in VBA.


Can provide locale-specific content including UI strings, add-in name, description, icon, source file and date/time format
The office.js supports two properties

var = office.context.displayLanguage 
var = office.context.contentLanguage


When a supported add-in starts, it reads the XML manifest
For Excel, Word, PowerPoint and Project the add-in loads when a document is opened or the add-in is inserted making the UI visible.
For Outlook whenever the context satsifies the activation of an add-in, then the UI is visible
The Office application opens the HTML page in a browser control (or an iFrame if it's a web application). The browser control uses Internet Explorer 9 components and security.
The OnLoad event is called
The office add-in framework calls the event handler for the initialize event of the Office object
When the HTML finishes loading the add-in finishes initializing and the main functionality can proceed

Office Add-in Cache

"userprofile"\local settings\application data\assembly

Office Runtime

Office add-ins are controlled by a specific runtime.
This runtime controls permissions as well as performance
This runtime protects the user experience
This runtime prevents any modal interactions
This runtime prevents any direct access to the host applications UI thread
This runtime isolates the process the app run in
This runtime manages the app lifecycle and interoperability between the app and the client host

© 2017 Better Solutions Limited. All Rights Reserved. © 2017 Better Solutions Limited