Protected Form

Hello to all,
we have an protected Word Document with many FormFields. Now we want to fill the FormFields wit some Data from our database. We don’t have the password from the Word Doument.
Can anybody tell me how we can fill the Fields (I am using c#)?
Thanks for your help and greetings from Berlin / Germany

Hi Christian,

Thanks for your inquiry. In your case, I suggest you please use Document.Unprotect method to remove the protection from the document regardless of the password and fill the form fields as shown in following code example. Please read following documentation link for your kind reference.

Moreover, you can protect the document by using Document.Protect method. Hope this helps you. Please let us know if you have any more queries.

Document doc = new Document(MyDir + "FormFields.doc");
// unprotect the document
foreach (FormField formField in doc.Range.FormFields)
    if (formField.Type.Equals(FieldType.FieldFormTextInput))
        formField.Result = "My name is " + formField.Name;
// Protect the document 
doc.Protect(ProtectionType.ReadOnly, "password");
doc.Save(MyDir + "Out.docx");