Word.ContentControlAddedEventArgs interface

提供有关引发 contentControlAdded 事件的内容控件的信息。

注解

[ API 集:WordApi 1.5 ]

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/10-content-controls/content-control-onadded-event.yaml

// Registers the onAdded event handler on the document.
await Word.run(async (context) => {
  eventContext = context.document.onContentControlAdded.add(contentControlAdded);
  await context.sync();

  console.log("Added event handler for when content controls are added.");
});

...

async function contentControlAdded(event: Word.ContentControlAddedEventArgs) {
  await Word.run(async (context) => {
    console.log(`${event.eventType} event detected. IDs of content controls that were added:`, event.ids);
  });
}

属性

eventType

事件类型。 请参阅Word。EventType 了解详细信息。

ids

获取内容控件 ID。

source

事件的源。 通过共同创作) ,它可以是本地或远程 (。

属性详细信息

eventType

事件类型。 请参阅Word。EventType 了解详细信息。

eventType: Word.EventType | "ContentControlDeleted" | "ContentControlSelectionChanged" | "ContentControlDataChanged" | "ContentControlAdded" | "ContentControlEntered" | "ContentControlExited" | "ParagraphAdded" | "ParagraphChanged" | "ParagraphDeleted" | "AnnotationClicked" | "AnnotationHovered" | "AnnotationInserted" | "AnnotationRemoved" | "AnnotationPopupAction";

属性值

Word.EventType | "ContentControlDeleted" | "ContentControlSelectionChanged" | "ContentControlDataChanged" | "ContentControlAdded" | "ContentControlEntered" | "ContentControlExited" | "ParagraphAdded" | "ParagraphChanged" | "ParagraphDeleted" | "AnnotationClicked" | "AnnotationHovered" | "AnnotationInserted" | "AnnotationRemoved" | "AnnotationPopupAction"

注解

[ API 集:WordApi 1.5 ]

ids

获取内容控件 ID。

ids: number[];

属性值

number[]

注解

[ API 集:WordApi 1.5 ]

source

事件的源。 通过共同创作) ,它可以是本地或远程 (。

source: Word.EventSource | "Local" | "Remote";

属性值

Word.EventSource | "Local" | "Remote"

注解

[ API 集:WordApi 1.5 ]