以编程方式删除或隐藏 Word 2007 中的注释/跟踪更改?

发布于 2024-07-17 08:42:07 字数 28 浏览 1 评论 0原文

我想知道这是否可能? 如果是的话怎么办?

I was wondering if this is possible? And if so how?

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

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

发布评论

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

评论(3

美人骨 2024-07-24 08:42:07

下面怎么样:

ActiveWindow.View.RevisionsView = wdRevisionsViewFinal
ActiveWindow.View.ShowRevisionsAndComments = False

这将显示没有标记的最终文档。

注意:ActiveWindow 是 Word.Application 类的属性

编辑:

这个答案使用 OLE 自动化,在重读您的问题时,这可能不是您正在寻找的内容,抱歉。

How about the following:

ActiveWindow.View.RevisionsView = wdRevisionsViewFinal
ActiveWindow.View.ShowRevisionsAndComments = False

This will show the Final document without markup.

Note: ActiveWindow is a property of the Word.Application class

EDIT:

This answer is using OLE Automation, on rereading your question this may not be what you're looking for, sorry.

遥远的绿洲 2024-07-24 08:42:07

以下是 Eric White 的帖子,展示了如何删除评论: https ://web.archive.org/web/20140510093032/http://blogs.msdn.com/b/ericwhite/archive/2008/07/14/using-the-open-xml-sdk-and-linq-to -xml-to-remove-comments-from-an-open-xml-wordprocessing-document.aspx

简而言之,这是他发布的代码:

XName commentRangeStart = w + "commentRangeStart";

XName commentRangeEnd = w + "commentRangeEnd";

XName commentReference = w + "commentReference";

mainDocumentXDoc.Descendants()

    .Where(x =>

       x.Name == commentRangeStart ||

       x.Name == commentRangeEnd ||

       x.Name == commentReference)

    .Remove();

Here's a post by Eric White that shows how to remove comments: https://web.archive.org/web/20140510093032/http://blogs.msdn.com/b/ericwhite/archive/2008/07/14/using-the-open-xml-sdk-and-linq-to-xml-to-remove-comments-from-an-open-xml-wordprocessing-document.aspx

In short here's the code that he published:

XName commentRangeStart = w + "commentRangeStart";

XName commentRangeEnd = w + "commentRangeEnd";

XName commentReference = w + "commentReference";

mainDocumentXDoc.Descendants()

    .Where(x =>

       x.Name == commentRangeStart ||

       x.Name == commentRangeEnd ||

       x.Name == commentReference)

    .Remove();
回忆那么伤 2024-07-24 08:42:07

通过将 ActiveDocument.TrackRevisions 设置为 True/False 来打开/关闭跟踪更改。

Toggle on/off Track Changes by setting ActiveDocument.TrackRevisions to True/False.

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