Office.AddBindingFromNamedItemOptions interface

提供用于配置创建的绑定的选项。

注解

使用方

示例

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

// Creates a text binding from the title of a Rich Text content control.
const options: Office.AddBindingFromNamedItemOptions = { id: bindingId };
Office.context.document.bindings.addFromNamedItemAsync(
    namedItemTitle,
    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}".`);
    }
);

属性

asyncContext

在传递到回调的 AsyncResult 对象的 asyncContext 属性中返回的任何类型的用户定义项,保持不变。

id

绑定的唯一 ID。 如果未提供,则自动生成。

属性详细信息

asyncContext

在传递到回调的 AsyncResult 对象的 asyncContext 属性中返回的任何类型的用户定义项,保持不变。

asyncContext?: any

属性值

any

id

绑定的唯一 ID。 如果未提供,则自动生成。

id?: string

属性值

string