防止Microsoft Word将以编程方式打开的文件添加到其历史记录中 [英] Keep Microsoft Word from adding files opened programmatically to its History

查看:102
本文介绍了防止Microsoft Word将以编程方式打开的文件添加到其历史记录中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.NET程序,可以以编程方式以文字方式打开文件以对其进行修改.不幸的是,即使我不希望在以编程方式打开文件时发生这种情况,Microsoft word也会在其历史记录"中保留文件按单词打开的时间.

I have a .NET program that opens a file programmatically in word to modify it. Unfortunately, Microsoft word keeps the times the file was opened in word in its History, even though I don't want that to happen when the file is opened programmatically.

如何防止这种情况在.NET中发生?

How can I keep this from happening in .NET?

推荐答案

如果使用的是Documents.OpenSaveAs,则可以这样设置AddToRecentFiles属性:

If you are using Documents.Open or SaveAs you can set the AddToRecentFiles property like this:

打开:

Globals.ThisAddIn.Application.Documents.Open("filename", AddToRecentFiles: false);

另存为:

Globals.ThisAddIn.Application.ActiveDocument.SaveAs2("filename", AddToRecentFiles: false);

这篇关于防止Microsoft Word将以编程方式打开的文件添加到其历史记录中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆