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

Free Support Forum - aspose.com

Word document, default open as read only. But type something then Word ask password for editing

create a .doc file.
when open it is read-only by default. if we click on any text and type some character MS Word will ask for a password to edit.

how to do this using ASPOSE.Words?

@davisaug_ncs_com_sg,

You can use the following overload of Protect method:

Document doc = new Document("E:\\temp\\input.docx");
doc.Protect(ProtectionType.ReadOnly, "password");
doc.Save("E:\\temp\\19.2.docx");

Also, in order to save document with encryption please use the following code snippet:

Document doc = new Document("E:\\Temp\\input.docx");

OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();
saveOptions.Password = "myPassword";

doc.Save("E:\\Temp\\out.docx", saveOptions);

Hope, this helps.