次の方法で共有


Word.ChangeTrackingState enum

ChangeTracking がオンのときにトラックの状態を指定します。

注釈

[ API セット: WordApi 1.5 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/10-content-controls/get-change-tracking-states.yaml

// Logs the current change tracking states of the content controls.
await Word.run(async (context) => {
  let trackAddedArray: Word.ChangeTrackingState[] = [Word.ChangeTrackingState.added];
  let trackDeletedArray: Word.ChangeTrackingState[] = [Word.ChangeTrackingState.deleted];
  let trackNormalArray: Word.ChangeTrackingState[] = [Word.ChangeTrackingState.normal];

  let addedContentControls = context.document.body.getContentControls().getByChangeTrackingStates(trackAddedArray);
  let deletedContentControls = context.document.body
    .getContentControls()
    .getByChangeTrackingStates(trackDeletedArray);
  let normalContentControls = context.document.body.getContentControls().getByChangeTrackingStates(trackNormalArray);

  addedContentControls.load();
  deletedContentControls.load();
  normalContentControls.load();
  await context.sync();

  console.log(`Number of content controls in Added state: ${addedContentControls.items.length}`);
  console.log(`Number of content controls in Deleted state: ${deletedContentControls.items.length}`);
  console.log(`Number of content controls in Normal state: ${normalContentControls.items.length}`);
});

フィールド

added = "Added"
deleted = "Deleted"
normal = "Normal"
unknown = "Unknown"