File not save as unprotected

I am not able to save the File as Unprotected.

Sample Code

var fs = new FileStream(@"00707351_00001_calypso.docx", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
Aspose.Words.Document doc = new Aspose.Words.Document(fs, new Aspose.Words.Loading.LoadOptions() { Password = "calypso" });
doc.Unprotect("calypso");
doc.Save(@"Unprotect.docx");// This file saved as password protected

File:
00707351_00001_calypso.docx (65 KB)

@hemalp Your document is encrypted and write protected. So you should specify encryption password on document load and reset write protection password to unprotect the document:

Document doc = new Document(@"C:\Temp\in.docx", new LoadOptions() { Password = "calypso" });
doc.WriteProtection.SetPassword("");
doc.Save(@"C:\Temp\out.docx");

Thank You @alexey.noskov. Your solution working properly

1 Like