Make entire workbook read only

Hi,

I have created an excel workbook that i need to make read-only. I'm using VS 2005 and Aspose 4.8.2. In going through earlier posts of the same kind, i noticed there was a function ProtectFile, which does not seem to be present in this version. I am using Workbook.Protect function, but that doesnt seem to make it read-only. I am still able to open file and make changes to the file and save it back. I am using

Workbook.Protect(ProtectionType.All, "aspose")

Your help would be very much appreciated.

Thanks,

Sreejtih

Hi,

The statement:

Workbook.Protect(ProtectionType.All, “aspose”)

This will protect your worokbook (Click Tools|Protection|Protect workbook… option in MS Excel 2003). It means it will protect a workbook’s structures and windows and you may see the a workbook contents and modify to re-save the file too. When you Unprotect workbook i.e…, giving the password, you may change the size of the window etc.

I think for your requirement, you may encrypt (password protect) the excel file.
See the links below:
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/encrypting-files.html
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/setting-strong-encryption-type.html

Alternatively, you can protect all the worksheets in the workbook.
See the link:
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/protecting-worksheets.html
When you protect a worksheet, users can see the worksheet contents but as read-only.

Thank you.