Edit

Share via


Word.WindowCloseOptions interface

The options that define whether to save changes before closing and whether to route the document.

Remarks

[ API set: WordApiDesktop 1.4 ]

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/99-preview-apis/close-document-window.yaml

await Word.run(async (context) => {
  // Closes the document window, prompting to save if this is a new document.
  const window: Word.Window = context.document.activeWindow;
  const closeOptions: Word.WindowCloseOptions = { saveChanges: Word.SaveConfiguration.promptToSaveChanges };
  console.log("About to close the document window...");
  window.close(closeOptions);
});

Properties

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.

saveChanges

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

[ API set: WordApiDesktop 1.4 ]

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"

Remarks

[ API set: WordApiDesktop 1.4 ]