Word.WindowCloseOptions interface
The options that define whether to save changes before closing and whether to route the document.
Remarks
Used by
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/50-document/close-document-window.yaml
// Closes the active document window with Word's prompt-to-save option.
if (!Office.context.requirements.isSetSupported("WordApiDesktop", "1.4")) {
console.error("This sample requires WordApiDesktop 1.4 or later.");
return;
}
await Word.run(async (context) => {
const window: Word.Window = context.document.activeWindow;
const saveChanges: Word.SaveConfiguration = Word.SaveConfiguration.promptToSaveChanges;
const closeOptions: Word.WindowCloseOptions = { saveChanges };
console.log("About to close the document window...");
window.close(closeOptions);
await context.sync();
});
Properties
| route |
If provided, specifies whether to route the document to the next recipient. If the document doesn't have a routing slip attached, this property is ignored. |
| save |
If provided, specifies the save action for the document. For available values, see Word.SaveConfiguration. |
Property Details
routeDocument
If provided, specifies whether to route the document to the next recipient. If the document doesn't have a routing slip attached, this property is ignored.
routeDocument?: boolean;
Property Value
boolean
Remarks
saveChanges
If provided, specifies the save action for the document. For available values, see Word.SaveConfiguration.
saveChanges?: Word.SaveConfiguration | "DoNotSaveChanges" | "SaveChanges" | "PromptToSaveChanges";
Property Value
Word.SaveConfiguration | "DoNotSaveChanges" | "SaveChanges" | "PromptToSaveChanges"