SaveEventArgs 接口

定义

BeforeSave 事件提供数据。

public interface class SaveEventArgs
[System.Runtime.InteropServices.Guid("06c7ed15-2df8-4a5c-acf4-10cdd5a6a510")]
public interface SaveEventArgs
[<System.Runtime.InteropServices.Guid("06c7ed15-2df8-4a5c-acf4-10cdd5a6a510")>]
type SaveEventArgs = interface
Public Interface SaveEventArgs
属性

示例

下面的代码示例演示 事件的事件处理程序 BeforeSave 。 保存文档时,事件处理程序会提示取消或继续执行保存操作。

此示例适用于文档级自定义项。

private void DocumentBeforeSave()
{
    this.BeforeSave += new Microsoft.Office.Tools.Word.SaveEventHandler(ThisDocument_BeforeSave);
}

void ThisDocument_BeforeSave(object sender, Microsoft.Office.Tools.Word.SaveEventArgs e)
{
    if (MessageBox.Show("Do you want to save the document?", "BeforeSave",
        MessageBoxButtons.YesNo) == DialogResult.No)
    {
        e.Cancel = true;
    }
}
Private Sub DocumentBeforeSave()
    AddHandler Me.BeforeSave, AddressOf ThisDocument_BeforeSave
End Sub

Private Sub ThisDocument_BeforeSave(ByVal sender As Object, ByVal e As Microsoft.Office.Tools.Word.SaveEventArgs)
    If MessageBox.Show("Do you want to save the document?", "BeforeSave", _
        MessageBoxButtons.YesNo) = DialogResult.No Then
        e.Cancel = True
    End If
End Sub

属性

Cancel

获取或设置指示是否取消保存操作的值。

ShowSaveAsDialog

获取或设置指示是否显示“另存为”对话框的值。

适用于