I want to know - does Aspose supports encryption of document. I dont’ need to protect my document from updating data. I need to protect it from openning without a password. Earlier I found that it was not supported in previous versions. Maybe it supports this feature now? And how, if it does?
Thanks for your inquiry. Please note that Aspose.Words supports most document protection features. Using Aspose.Words you can open a document that is password protected even without the password (as long as its not encrypted). Once document is loaded into Aspose.Words DOM, you can remove any protection from a document. You can use Document.Unprotect method to removes protection from the document regardless of the password. This method unprotects the document even if it has a protection password.
See the following links in the documentation for further information:
I want to create document that can be opened (viewed) only with password prompt. No need to protect data from updating - I need to protect from VIEWING. Another words, I want to create document and encrypt it with password.
Thanks for your inquiry.
I want to create document that can be opened (viewed) only with password prompt.
You can use DocSaveOptions.Password property sets a password to encrypt document using RC4 encryption method as shown in following code snippet.
Document doc = new Document(); DocSaveOptions options = new DocSaveOptions(SaveFormat.Doc); options.Password = "test"; doc.Save(MyDir + "AsposeOut.doc", options);
Please read following documentation links for your kind reference.
No need to protect data from updating - I need to protect from VIEWING. Another words, I want to create document and encrypt it with password.
Document doc = new Document(); doc.Protect(ProtectionType.ReadOnly, "password"); doc.Save(MyDir + "AsposeOut.doc");
Moreover, following code example protects a section so only editing in form fields is possible.
// Create a blank document Document doc = new Document(); // Insert two sections with some text DocumentBuilder builder = new DocumentBuilder(doc); builder.Writeln("Section 1. Unprotected."); builder.InsertBreak(BreakType.SectionBreakContinuous); builder.Writeln("Section 2. Protected."); // Section protection only works when document protection is turned and only editing in form fields is allowed. doc.Protect(ProtectionType.AllowOnlyFormFields); // By default, all sections are protected, but we can selectively turn protection off. doc.Sections.ProtectedForForms = false; builder.Document.Save(MyDir + "Section.Protect Out.doc");
Hope this answers your query. Please let us know if you have any more queries.