【发布时间】:2015-03-07 03:35:23
【问题描述】:
我正在用 c# 编写 Word 应用程序插件。
我正在尝试使用DocumentBeforeClose 事件:
Microsoft.Office.Tools.Word.Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
vstoDoc.BeforeClose += new System.ComponentModel.CancelEventHandler(ThisDocument_BeforeClose);
我可以处理它,但是当我尝试关闭和打开一个文档(不是整个应用程序)时,我无法再处理这个事件了。
编辑:
DocumentBeforeClose 很好。
但是我如何使用 ref bool Cancel
我试试:
void Application_DocumentBeforeClose(_Word.Document Doc, ref bool Cancel)
{
Cancel = true;
}
但它不起作用:(
【问题讨论】: