We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Password Protection of Word Documents

Thread ID:

Created:

Updated:

Platform:

Replies:

72182 Mar 6,2008 11:21 AM Mar 7,2008 01:55 AM ASP.NET Web Forms (Classic) 1
loading
Tags: DocIO
Howard
Asked On March 6, 2008 11:21 AM

Hello!

I would like to clone an MS Word document with a new name AND password protect it.
I need the user to be prompted for the password when they attempt to open it.

The following code works (without password protection).

------------------------
Dim sourceDoc As WordDocument = New WordDocument()
sourceDoc.Open(sSourceFile, FormatType.Doc)

Dim doc As WordDocument = New WordDocument()
doc.EnsureMinimal()

doc = sourceDoc.Clone()
doc.Save(sDestFile, FormatType.Doc)

------------------------

The following code gives an error on line 3.
"Cannot open storage. File Name is: C:\abc\xyz.doc"

------------------------
Dim sourceDoc As WordDocument = New WordDocument()
sourceDoc.Open(sSourceFile, FormatType.Doc)

Dim doc As WordDocument = New WordDocument(sDestFile, "password")
doc.EnsureMinimal()

doc = sourceDoc.Clone()
doc.ProtectionType = ProtectionType.AllowOnlyFormFields

doc.Save(sDestFile, FormatType.Doc)

------------------------

Also, the avalable options for ProtectionType do not include one to
prompt the user for a password when they attempt to open the doc file.

Please help!
Thanks!
Howard



Administrator [Syncfusion]
Replied On March 7, 2008 01:55 AM

Hi Howard,

Thank you for your interest in Syncfusion products.

protect the word document by providing password.

The "Password" property of the class "WordDocument" is not a protection password - it is the password to open the document.
We can able to set only protection type of the document. The protection password is not supported by DocIO. We have already created feature request regarding this and We do not have immediate plan for implementing this feature in the near future.

Sorry for the onconvenience.

Please let me know if you have any questions.

Best Regards,
Bhuvana



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;