问题
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.
How can I keep this from happening in .NET?
回答1:
If you are using Documents.Open
or SaveAs
you can set the AddToRecentFiles
property like this:
Open:
Globals.ThisAddIn.Application.Documents.Open("filename", AddToRecentFiles: false);
Save as:
Globals.ThisAddIn.Application.ActiveDocument.SaveAs2("filename", AddToRecentFiles: false);
来源:https://stackoverflow.com/questions/23059858/keep-microsoft-word-from-adding-files-opened-programmatically-to-its-history