Word.ChangeTrackingState enum
Specify the track state when ChangeTracking is on.
Remarks
Examples
// 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}`);
});
Fields
added = "Added" | |
deleted = "Deleted" | |
normal = "Normal" | |
unknown = "Unknown" |
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Office Add-ins