Changing Read-only word file to a editable file

Hi, do you have any library to convert a read-only word document to an editable word document? This is for aspose .Net.

@vasudevan You can use Document.Unprotect method to unprotect the document. Please see our documentation for more information:
https://docs.aspose.com/words/net/open-a-document-read-only/

test.docx (25.4 KB)

I have the attached document as a read only document. As per your reply, I tried using Document.Unprotect(); , and save the final document in word file, still the document was in the Read only mode. I also tried using - document.Protect(ProtectionType.NoProtection);. This one didn’t work either. Could you please help?

Moreover, is there any library to detect if the document is in read-only mode? We want to reject any document that is in Read-Only mode from coming into our system.

@vasudevan Your document is write protected not read only protected. So you should reset write protection to unprotect the document:

Document doc = new Document(@"C:\Temp\in.docx");
doc.WriteProtection.ReadOnlyRecommended = false;
doc.WriteProtection.SetPassword("");
doc.Save(@"C:\Temp\out.docx");

Please see WriteProtection class for more information. You can use WriteProtection.IsWriteProtected property to check whether the document is write protected.

document.WriteProtection.IsWriteProtected returns false for the document I attached earlier. Please help.

@vasudevan In your case WriteProtection.ReadOnlyRecommended is set:

<w:writeProtection w:recommended="1"/>