0
votes

My word addin writes some stuff to the document in the AddIn_Startup event (of course under some conditions ;-) ). When a document is recovered, most of the time there is recovered text in the document and I dont want to write in the recovered file with my generated text.

So I need to know how it is possible to determine if the ActiveDocument is recovered.

I am using C# and Visual Studio Tools for Office 2010.

1
Can you show us some code ? - invidicult
Well, I just need a condition befor i write the text to the document for example if(Application.ActiveDocument.IsInRecoveryMode) But i cant find anything like that. - Manuel Schumach

1 Answers

0
votes

The Word object model doesn't provide anything for that. But you can use CustomDocumentProperties for adding a marker that you have already added the text to the document. See the CustomDocumentProperties property of the Document class for more information. It returns a DocumentProperties collection that represents all the custom document properties for the specified document. Before adding a text you can check out the value of custom property and decide whether you need to add the text or not.