Context.document property (JavaScript API for Office)

apps for Office

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

Last modified: February 27, 2015

Hosts:

Access, Excel, PowerPoint, Project, Word

Last changed in

1.1

See all support details

var _document = Office.context.document;

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).

// 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;
    });
}

A checkmark (√) in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this property.

For more information about Office host application and server requirements, see Requirements for running apps for Office.

Office for Windows desktop

Office for Windows RT

Office Online
(in browser)

Access

Excel

PowerPoint

Project

Word

Minimum permission level

Restricted

App types

Content, task pane

Library

Office.js

Namespace

Office

Version

Changes

1.1

Added support for Office.context.document to access the database in content apps for Access.

1.0

Introduced

Show:
© 2015 Microsoft