Disabling auto-recovery in word
I'm currently working on an add-in for word 2k3/2k7. I am currently limiting access to documents for users that do not use my add-in. So basically I decrypt the file using my add-in when the doc is opened and encrypt it on document close. The problem I have now is that word has this auto recovery thing 开发者_运维知识库which will save temporary files unencrypted and so if word crashes the users will have access to the doc even if they dont use the add-in.
So my question is, is there a way to programmatically disable auto recovery in word? If not, could anyone suggest another solution for this problem?
I'm not 100% sure it would work, but you can try this:
Sub DisableAutoRecover()
Options.SaveInterval = 0
End Sub
Note: I wrote a VBA example as I didn't work with C# and Word so far. It shouldn't be difficult to "port" it, though.
public void getstyle(Word.Document doc)
{
if (doc.Application.Options.SaveInterval==10)
{
doc.Application.Options.SaveInterval = 0;
}
}
精彩评论