Compartilhar via


Word.ContentControlSelectionChangedEventArgs interface

Fornece informações sobre o controlo de conteúdo que levantou o evento contentControlSelectionChanged.

Comentários

[ Conjunto de API: WordApi 1.5 ]

Exemplos

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

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

  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].onSelectionChanged.add(contentControlSelectionChanged);
      contentControls.items[i].track();
    }

    await context.sync();

    console.log("Added event handlers for when selections are changed in content controls.");
  }
});

...

async function contentControlSelectionChanged(event: Word.ContentControlSelectionChangedEventArgs) {
  await Word.run(async (context) => {
    console.log(`${event.eventType} event detected. IDs of content controls where selection was changed:`, event.ids);
  });
}

Propriedades

eventType

O tipo de evento. Veja Word. EventType para obter detalhes.

ids

Obtém os IDs de controlo de conteúdo.

source

A origem do evento. Pode ser local ou remoto (através da cocriação).

Detalhes da propriedade

eventType

O tipo de evento. Veja Word. EventType para obter detalhes.

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

Valor da propriedade

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

Comentários

[ Conjunto de API: WordApi 1.5 ]

ids

Obtém os IDs de controlo de conteúdo.

ids: number[];

Valor da propriedade

number[]

Comentários

[ Conjunto de API: WordApi 1.5 ]

source

A origem do evento. Pode ser local ou remoto (através da cocriação).

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

Valor da propriedade

Word.EventSource | "Local" | "Remote"

Comentários

[ Conjunto de API: WordApi 1.5 ]