Поделиться через


Word.ContentControlEnteredEventArgs interface

Предоставляет сведения об элементе управления содержимым, который вызвал contentControlEntered событие.

Замечания

[ Набор API: WordApi 1.5 ]

Примеры

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

await Word.run(async (context) => {
  const contentControls: Word.ContentControlCollection = context.document.contentControls;
  contentControls.load("items");
  await context.sync();

  // Register the onEntered event handler on each content control.
  if (contentControls.items.length === 0) {
    console.log("There aren't any content controls in this document so can't register event handlers.");
  } else {
    for (let i = 0; i < contentControls.items.length; i++) {
      eventContexts[i] = contentControls.items[i].onEntered.add(contentControlEntered);
      contentControls.items[i].track();
    }

    await context.sync();

    console.log("Added event handlers for when the cursor is placed in content controls.");
  }
});

...

async function contentControlEntered(event: Word.ContentControlEnteredEventArgs) {
  await Word.run(async (context) => {
    console.log(`${event.eventType} event detected. ID of content control that was entered: ${event.ids[0]}`);
  });
}

Свойства

eventType

Указывает тип события. Дополнительные сведения см. в этой Word.EventType статье.

ids

Возвращает идентификаторы элементов управления содержимым.

source

Указывает источник события. Он может быть локальным или удаленным (с помощью совместного редактирования).

Подробнее

eventType

Указывает тип события. Дополнительные сведения см. в этой Word.EventType статье.

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

Стоимость недвижимости

Word.EventType | "ContentControlDeleted" | "ContentControlSelectionChanged" | "ContentControlDataChanged" | "ContentControlAdded" | "CommentDeleted" | "CommentSelected" | "CommentDeselected" | "CommentChanged" | "CommentAdded" | "ContentControlEntered" | "ContentControlExited" | "ParagraphAdded" | "ParagraphChanged" | "ParagraphDeleted" | "AnnotationClicked" | "AnnotationHovered" | "AnnotationInserted" | "AnnotationRemoved" | "AnnotationPopupAction"

Замечания

[ Набор API: WordApi 1.5 ]

ids

Возвращает идентификаторы элементов управления содержимым.

ids: number[];

Стоимость недвижимости

number[]

Замечания

[ Набор API: WordApi 1.5 ]

source

Указывает источник события. Он может быть локальным или удаленным (с помощью совместного редактирования).

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

Стоимость недвижимости

Word.EventSource | "Local" | "Remote"

Замечания

[ Набор API: WordApi 1.5 ]