Word.ContentControlState enum
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Represents the state of the content control.
Remarks
API set: WordApi BETA (PREVIEW ONLY)
Used by
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/99-preview-apis/insert-and-change-content-controls.yaml
// Marks the sample content control with a warning.
await Word.run(async (context) => {
const sampleControl: Word.ContentControl = context.document.contentControls
.getByTag("ContentControlStateSample").getFirstOrNullObject();
await context.sync();
if (sampleControl.isNullObject) {
console.warn("Run Set up to create the sample content control.");
return;
}
const state: Word.ContentControlState = Word.ContentControlState.warning;
sampleControl.setState(state);
await context.sync();
console.log(`Set sample content control state to ${state}.`);
});
Fields
| error = "Error" | Error state. |
| warning = "Warning" | Warning state. |