Word.SaveConfiguration enum

指定保存选项。

注解

API 集:WordApiDesktop 1.4

使用方

示例

// 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();
});

字段

doNotSaveChanges = "DoNotSaveChanges"

指定不保存更改。

promptToSaveChanges = "PromptToSaveChanges"

指定提示保存更改。

saveChanges = "SaveChanges"

指定保存更改。