Reputation: 15
the word api (interop and vba) allow to call Document.Protect([...],NoReset,[...])
with a NoReset
flag. Is there any way to find out if this flag is set by a protected document? I look into OpenXML specification and compare two documents which have the same structure but protected with enabled/disabled flag.
Problem
The problem behind is that i call ActiveDocument.Fields.Update()
in my code for documents which are not protected by myself. When i do it and the flag is not set the FormField.Result
values will be reset to the FormField.TextInput.Default
value and this i will prevent.
So the question is how can i find out before i call Update()
if this flag is set or not.
Knowledge
What i find out now is that there is actual no property in the object model which i can call to check if the property is set. The OpenXML specification has also no flag on top the formfield xml specification.The only differences i see in comparison of this, is that Word also added revision id`s to the xml.
Maybe someone has a little bit more informations and can help.
Best regards Daniel
Upvotes: 0
Views: 323
Reputation: 15
Okay the solution for this problem (see comments) is to understand first that there a two problems.
First problem:
NoReset
flag is only evaluated at runtime if Document.Protect
is called.
secound problem:
If the document is unprotected word`s standard behaviour is to reset FormFields
if Fields.Update
is called. To avoid this you can enumerate the Field
collection and check if Field.Type
is not wdFieldFormTextInput
and call than Field.Update
Upvotes: 0