Compartir a través de


Word.ContentControlDataChangedEventArgs interface

Proporciona información sobre el control de contenido que generó el evento contentControlDataChanged.

Comentarios

[ Conjunto de API: WordApi 1.5 ]

Ejemplos

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

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

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

    await context.sync();

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

...

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

Propiedades

eventType

El tipo de evento. Consulte Word. EventType para obtener más información.

ids

Obtiene los identificadores de control de contenido.

source

Origen del evento. Puede ser local o remota (a través de la coautoría).

Detalles de las propiedades

eventType

El tipo de evento. Consulte Word. EventType para obtener más información.

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

Valor de propiedad

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

Comentarios

[ Conjunto de API: WordApi 1.5 ]

ids

Obtiene los identificadores de control de contenido.

ids: number[];

Valor de propiedad

number[]

Comentarios

[ Conjunto de API: WordApi 1.5 ]

source

Origen del evento. Puede ser local o remota (a través de la coautoría).

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

Valor de propiedad

Word.EventSource | "Local" | "Remote"

Comentarios

[ Conjunto de API: WordApi 1.5 ]