WPS 基础接口 > 演示 API 参考 > Application > 事件 > Application.PresentationBeforeSave 事件
保存演示文稿前发生此事件。

语法

表达式.PresentationBeforeSave(Pres, Cancel)

表达式   一个代表 Application 对象的变量。

参数

名称 必选/可选 数据类型 描述
Pres 必选 Presentation 正在保存的演示文稿。
Cancel 必选 Boolean 如果该参数值为 True,则取消保存过程。

说明

此事件在“另存为”对话框出现时触发。

要访问 Application 事件,请在代码的通用声明部分中声明一个 Application 变量。然后将此变量设置为要访问其事件的 Application 对象。有关使用 WPP Application 对象的事件的信息,请参阅 使用 Application 对象的事件。

示例

本示例检查演示文稿中是否存在改动。如果存在改动,会询问是否保存演示文稿。如果用户的答复为不保存,将取消保存过程。该示例假定已使用 WithEvents 关键字声明了一个称为 PPTApp 的 Application 对象。

示例代码
function Application_PresentationBeforeSave(Pres, Cancel) {
    let intResponse
    if(Pres.HasRevisionInfo == false) {
        intResponse = MsgBox("The presentation contains revisions. " + "Do you want to accept the revisions before saving ", jsYesNo)
        if(intResponse == jsResultYes) {
            Cancel = true
            MsgBox("Your presentation was not saved.")
        }
    }
}


请参阅