Export (0) Print
Expand All

Context.document property (JavaScript API for Office v1.1)

JavaScript API for Office v1.1

Gets an object that represents the document the app in interacting with.

Last modified: June 12, 2014

Introduced in Office.js version

1.0

Updated in Office.js version

1.1

var _document = Office.context.document;

In JavaScript API for Office v1.1, your app can use the document property to access API for interacting with content in documents, workbooks, presentations, projects, and databases (in Access web applications). See the Requirements section for a list of supported Office host applications.

You can call Office.context.document to access the database in content apps for Access.

// Extension initialization code.
var _document;

// The initialize function is required for all apps.
Office.initialize = function () {
    // Checks for the DOM to load using the jQuery ready function.
    $(document).ready(function () {
    // After the DOM is loaded, app-specific code can run.
    // Initialize instance variables to access API objects.
    _document = Office.context.document;
    });
}

App types

Content apps, Task pane apps

Supported clients

Access app for SharePoint, Excel 2013, Excel 2013 SP1, Excel 2013 RT, Excel Online, Word 2013, Word 2013 SP1, Word 2013 RT, Project 2013, Project 2013 SP1, PowerPoint Online, PowerPoint 2013, PowerPoint 2013 SP1, PowerPoint 2013 RT

Library

Office.js

Namespace

Office

Show:
© 2014 Microsoft