Partager via


Word.ContentControlExitedEventArgs interface

Fournit des informations sur le contrôle de contenu qui a déclenché l’événement contentControlExited.

Remarques

[ Ensemble d’API : WordApi 1.5 ]

Exemples

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

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

  // Register the onExited 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].onExited.add(contentControlExited);
      contentControls.items[i].track();
    }

    await context.sync();

    console.log("Added event handlers for when the cursor is removed from within content controls.");
  }
});

...

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

Propriétés

eventType

Type d’événement. Voir Word. EventType pour plus d’informations.

ids

Obtient les ID de contrôle de contenu.

source

Source de l'événement. Il peut être local ou distant (via la co-création).

Détails de la propriété

eventType

Type d’événement. Voir Word. EventType pour plus d’informations.

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

Valeur de propriété

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

Remarques

[ Ensemble d’API : WordApi 1.5 ]

ids

Obtient les ID de contrôle de contenu.

ids: number[];

Valeur de propriété

number[]

Remarques

[ Ensemble d’API : WordApi 1.5 ]

source

Source de l'événement. Il peut être local ou distant (via la co-création).

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

Valeur de propriété

Word.EventSource | "Local" | "Remote"

Remarques

[ Ensemble d’API : WordApi 1.5 ]