We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Remove write protection in Word 2010 document (docx)


I have a password protected docx file. I need to remove the write protection using aspose and save the docx without protection. When i use the below code the docx protection is removed but when opening it shows some error message as “Word found unreadable content…” (Please see the error screen shots)

I am using Aspose.Words version

Input File is “PwdDocx.docx”. Its password is "test"
Output File is "TestOutput.docx"
Error screenshots are “err1.png” and “err2.png”.

This is my sample code:

using (System.IO.Stream stream = new System.IO.MemoryStream(input))
Aspose.Words.Document wDoc = new Aspose.Words.Document(stream, new Aspose.Words.LoadOptions() { Password = “test” });
Aspose.Words.SaveFormat save = Aspose.Words.FileFormatUtil.LoadFormatToSaveFormat(wDoc.OriginalLoadFormat);
Aspose.Words.Saving.OoxmlSaveOptions sOptions = new Aspose.Words.Saving.OoxmlSaveOptions(save);
sOptions.Compliance = Aspose.Words.Saving.OoxmlCompliance.Iso29500_2008_Transitional;
System.IO.MemoryStream outStream;
//convert page by page
for (int i = 0; i < wDoc.PageCount; i++)
outStream = new MemoryStream();
options.PageIndex = i;
options.PageCount = 1;
wDoc.Save(outStream, sOptions);
output = ConvertBinaryFileToArray(outStream);
// Close/Dispose stream

//Convert stream to byte array
private byte[] ConvertBinaryFileToArray(MemoryStream inputStream)
BinaryWriter bwriter = new BinaryWriter(inputStream);
byte[] array = inputStream.ToArray();
return array;

Hoping to get a solution as soon as possible.

Jeshwel J

Hi Jeshwel,

Thanks for your inquiry. First off, I would suggest you please upgrade to the latest version of Aspose.Words (i.e. 13.6.0) from the following link:

Secondly, your document has no protection but it is encrypted that is why Microsoft Word asks for a password prior opening it. If you open/save this document by using the following code, the output document will not be encrypted, i.e. Microsoft Word will not ask you to enter the password to open it.

Document doc = new
new Aspose.Words.LoadOptions(LoadFormat.Docx, “test”,


I hope, this helps.

Best regards,

Thanks Hafeez, I got know what i was doing wrong…everything works fine now.