Word.ChangeTrackingState enum
指定启用 ChangeTracking 时的跟踪状态。
注解
示例
// 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" |