Edit

Office.AddBindingFromSelectionOptions interface

Provides options for identifying the binding that is created.

Remarks

Used by

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/03-bindings/manage-bindings.yaml

// Creates a text binding from the current selection.
const options: Office.AddBindingFromSelectionOptions = { id: bindingId };
Office.context.document.bindings.addFromSelectionAsync(
    Office.BindingType.Text,
    options,
    (asyncResult) => {
        if (asyncResult.status === Office.AsyncResultStatus.Failed) {
            console.error(asyncResult.error.message);
            return;
        }

        console.log(`Created binding "${asyncResult.value.id}" of type "${asyncResult.value.type}".`);
    }
);

Properties

asyncContext

A user-defined item of any type that is returned, unchanged, in the asyncContext property of the AsyncResult object that is passed to a callback.

columns

The names of the columns involved in the binding.

id

The unique ID of the binding. Autogenerated if not supplied.

Property Details

asyncContext

A user-defined item of any type that is returned, unchanged, in the asyncContext property of the AsyncResult object that is passed to a callback.

asyncContext?: any

Property Value

any

columns

The names of the columns involved in the binding.

columns?: string[]

Property Value

string[]

id

The unique ID of the binding. Autogenerated if not supplied.

id?: string

Property Value

string