Could the api remove the Open/Modify password?

Hi,Support:
Could the Aspose.words.dll remove then open/modify passowrd of a doc?
if so, how to implement it?
Thanks for your help.

@ducaisoft,

You can use Document.Unprotect Method to remove protection from Word document.

Document doc = new Document("C:\\Temp\\source.doc");
doc.Unprotect();
// do any modifications
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToDocumentEnd();
builder.Writeln("new content etc");
// Save to DOC format
doc.Save(@"C:\Temp\output.doc");

Similarly, you can use Document.Protect Method to protect the Word document from changes.

In case the problem still remains, then please ZIP and attach your simplified source Word document (you want to remove/modify password from) here for testing. We will then start further investigation into your scenario and provide you more information.

The API can not open a doc protected with open-password, so the doc.unprotect method fail.
It is expected to add this feature for further version.
the method doc.unprotect only take effect after the doc has been open/Read into memory.

And else, what is the usage of Aspose.Words.Pdf2Word.dll?

@ducaisoft,

If a Word document is encrypted then Microsoft Word will also ask for a password prior opening it. Similarly, you need to first specify the password to open the encrypted document using Aspose.Words.

Aspose.Words.LoadOptions loadOptions = new Aspose.Words.LoadOptions();
loadOptions.LoadFormat = LoadFormat.Docx;
loadOptions.Password = "1234";
Document doc = new Document("C:\\Temp\\encrypted word.docx", loadOptions);
// Generated docx will no longer be encrypted with password
doc.Save(@"C:\Temp\output.docx");

If you do not know the password, then you will not be able to open this document by using Aspose.Words. Aspose.Words will throw the following error upon loading such documents without specifying password:

Aspose.Words.IncorrectPasswordException
  HResult=0x80131500
  Message=The document password is incorrect.
  Source=Aspose.Words

However, you can only check if a Word document is encrypted or not by using the following simple code:

FileFormatInfo info = FileFormatUtil.DetectFileFormat("C:\\Temp\\encrypted word.docx");
Console.WriteLine("IsEncrypted = " + info.IsEncrypted);

Secondly, you can reference/use this ‘Aspose.Words.Pdf2Word.dll’ in your Visual Studio project to be able to process (load, manipulate) PDF files by using Aspose.Words for .NET API.

P.S. Starting from the 20.2 release , Aspose.Words for .NET supports loading/processing PDF file format in its .NET Standard variant (i.e. use the DLLs from netstandard2.0 folder ). After that, starting from the 20.4 release, Aspose.Words also provides DLL for .NET 4.6.1 (i.e. use DLLs from net461 folder ) to read/load/process PDF documents.