Force the saved file to be opened as Readonly

Dear,


In Excel, there is an option to save the document and recommend to open it as readonly.

I am looking for an Aspose solution of that but I don’t find any.

Can someone help me ?

For information I’m using Aspose Cells 8.1.

Kristoffer Delforge

Hi Kristoffer,


Thank you for considering Aspose APIs.

We believe you wish to protect the worksheets in a way that you could restrict the add/update/delete actions for the user. If we are correct in our understanding, please refer to the following article on this subject.

Dear Babar,


I’ve seen the Protect method on both the worksheet and the workbook. However, this does not match my requirements.

The property to recommend the opening as ReadOnly of an Excel file is the correct solution for my requirement.

In fact, I need to be able to save my Aspose Cells document even if it is in use by another process. The only way is to have an opening as readonly of the file.

Hi,


I think you may try to set the Password for write protection/ modifications, see the sample code for your reference:
e.g
Sample code:

//Open an Excel file.
Workbook workbook = new Workbook(@“e:\test\Book1.xls”);
//Set Passord to modify option.
workbook.Settings.IsWriteProtected = true;
//Set the password for modification.
workbook.Settings.WriteProtectedPassword = “1234”;
//Save the Excel file.
workbook.Save(@“e:\test\Book2.xls”);

Thank you.