Ms word 互操作,撤消word撤消堆栈中的所有操作

Ms word 互操作,撤消word撤消堆栈中的所有操作,ms-word,office-interop,Ms Word,Office Interop,我正在使用c#和word互操作。 如何以编程方式撤消word撤消堆栈中的所有操作 注意。以下是解决方案: object times = 1; while (worDocument.Undo(ref times)) {} 但在调用像ContentControlBeforeDelete这样的代码词事件处理程序之前,必须先删除ContentControlOneNet和ContentControlOnExit,否则word将冻结()

我正在使用c#和word互操作。 如何以编程方式撤消word撤消堆栈中的所有操作

注意。

以下是解决方案:

object times = 1;
while (worDocument.Undo(ref times))
{}
但在调用像ContentControlBeforeDelete这样的代码词事件处理程序之前,必须先删除ContentControlOneNet和ContentControlOnExit,否则word将冻结()