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

发布于 2024-09-18 04:49:21 字数 62 浏览 8 评论 0原文

我正在使用 C# 和 Word 互操作。 如何以编程方式撤消单词撤消堆栈中的所有操作?

问候。

I am using c# and word interop.
How can I, programmatically, undo all actions in word undo stack?

Regards.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

绝情姑娘 2024-09-25 04:49:21

这是解决方案:

object times = 1;
while (worDocument.Undo(ref times))
{}

但在调用此代码之前,必须删除诸如 ContentControlBeforeDelete、ContentControlOnEnter 和 ContentControlOnExit 等字事件处理程序,否则字会冻结(http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/50a96ba1-85e3-498f-89bb- 4181220a565f)。

Here is the solution :

object times = 1;
while (worDocument.Undo(ref times))
{}

But before calling this code word event handlers like ContentControlBeforeDelete, ContentControlOnEnter and ContentControlOnExit must be removed otherwise word freezes(http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/50a96ba1-85e3-498f-89bb-4181220a565f).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文