Open as Read-Only?

Is there a way to open a Word file as read-only? I don’t see it as one of the available options in LoadOptions.
I’d like to allow my end-user to select and process Word documents that are currently open in Microsoft Word. This shouldn’t be a problem if the access is read only. Indeed, with interop, I can open currently-open docs if I specify read-only. Is there any way to do this with Aspose?

Hi Avi,

Thanks for your query. Please use the following code snippet for your requirement.

Document doc = new Document(MyDir + "in.docx");
// Insert two sections with some text
DocumentBuilder builder = new DocumentBuilder(doc);
// No changes are allowed to the document.
doc.Protect(ProtectionType.ReadOnly, "Password");
builder.Document.Save(MyDir + "AsposeOut.docx");

Please read following documentation links for your kind reference. Let us know if you have any more queries.

https://docs.aspose.com/words/java/protect-or-encrypt-a-document/
https://reference.aspose.com/words/net/aspose.words/protectiontype/

Thank you

Hi Avi,

Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.