Retrieving Password from the document to reaaply in Protect function

Hi,
I have two simple questions.
First: Can we retrieve the password of the document using Aspose Words object functions if yes then what is that function. Problem is that we are merging several forms in a combined document but each form has their own passwords - unfortunately combined document is gets unprotected so I have to use

finalcombinedDocument.Protect(ProtectionType.AllowOnlyFormFields, stringPassword);

but we want to retrieve the password from the document parts/forms so it’s dynamic, assign it to stringPassword variable. What should I do to retrieve password programmatically.
Second: Since my combined document has multiple forms merged in it and each of those forms can have separate passwords so the big question is - can I set the passwords in the combined document at the sections level so in a combined document one section representing one form can be editable/unprotected, second section representing another form (merged/appended) in the same combined document can be protected with password1, and the third section representing third form (merged/appended) in the same combined document can have password protection using password2 - different than the password on section 2.
Thanks in advance for all your help.
Thanks,
Ramesh

Hi

Thanks for your request.

  1. There is no way to get password using Aspose.Words. I think in this case you can append your document to the main document, which is already protected with password. In this case, password of the main document should be preserved.
  2. There is no way to protect sections of the document with different passwords.

Best regards.

Hi Alexi,
Thanks for the quick reply. Thanks for clarifying in point two.
I have question on point one: My first document (first section - one section document) in the combined document is actually unprotected, whereas second and third document in the merged document are the really protected one.
In a way only meddle documents are protected but first document is definitely unprotected for users to complete manually as they wish.
Is there anyway, I can preserve the password protection on second and third documents as the password of main document. Please advice if it is even feasible.
Also I don’t want to decrypt the password, idea is that I want to retrieve and assign to a variable so I can pass in Protect function. Even if it is hashed or encrypted it should work in the Protect function right? Please let me know if it’s feasible with Aspose Word APIs or not. Seems like it is not feasible but just wanted to make sure.
Thanks,
Ramesh

Hi

Thanks for your request. The information about document protection is stored on document level, when you merge your document into one document, you just copy section from source documents to the main document. So if your main document was protected the result document is protected either. However if the main document is unprotected, the result document will also becomes unprotected. There is no way to preserve protection and passwords of the separate sections during merging.
Best regards.