Binding object (JavaScript API for Office)

Office Add-ins

An abstract class that represents a binding to a section of the document.

Last modified: August 04, 2015

Note Note

The name "apps for Office" is changing to "Office Add-ins". During the transition, the documentation and the UI of some Office host applications and Visual Studio tools might still use the term "apps for Office". For details, see New name for apps for Office and SharePoint.

Hosts:

Access, Excel, Word

Available in Requirement sets

MatrixBinding, TableBinding, TextBinding

Last changed in TableBinding

1.1

See all support details

Office.context.document.bindings.getByIdAsync(id);
Office.select("bindings#id);

Objects

Name

Description

MatrixBinding

Represents a binding in two dimensions of rows and columns.

TableBinding

Represents a binding in two dimensions of rows and columns, optionally with headers.

TextBinding

Represents a bound text selection in the document.

Properties

Name

Description

document

Get the Document object associated with the binding.

id

Gets the identifier of the object.

type

Gets the type of the binding.

Methods

Name

Description

addHandlerAsync

Adds a handler to the binding for the specified event type.

getDataAsync

Returns the data contained within the binding.

removeHandlerAsync

Removes the specified handler from the binding for the specified event type.

setDataAsync

Writes data to the bound section of the document represented by the specified binding object.

TableBinding.setFormatsAsync

Sets or updates formatting on specified items and data in the bound table.

Events

Name

Description

bindingDataChanged

Occurs when data within the binding is changed.

bindingSelectionChanged

Occurs when the selection is changed within the binding.

The Binding object exposes the functionality possessed by all bindings regardless of type.

The Binding object is never called directly. It is the abstract parent class of the objects that represent each type of binding: MatrixBinding, TableBinding, or TextBinding. All three of these objects inherit the getDataAsync and setDataAsync methods from the Binding object that enable to you interact with the data in the binding. They also inherit the id and type properties for querying those property values. Additionally, the MatrixBinding and TableBinding objects expose additional methods for matrix- and table-specific features, such as counting the number of rows and columns.

Support for each API member of the Binding object differs across Office host applications. See the "Support details" section of each member's topic for host support information.

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

Available in requirement sets

MatrixBinding, TableBinding, TextBinding

App types

Content, task pane

Library

Office.js

Namespace

Office

Show:
© 2015 Microsoft