I am using Open XML SDK for creating excel files.
I want to protect them with a password.
Do you know anyway to protect excel file with a password by using Open XML SDK?
I know "com" object way to protect them however, it is not suitable for my application. I need to protect file by using Open XML SDK or another way.
Creating an excel password for protecting workbook or worksheet is possible by open xml.
Following code samples are suggestions of Vincent (http://spreadsheetlight.com/about/) (https://stackoverflow.com/users/12984/vincent-tan) (again I thank him a lot :)
If you have a chart or something then
Following code samples are suggestions of Vincent (http://spreadsheetlight.com/about/) (https://stackoverflow.com/users/12984/vincent-tan) (again I thank him a lot :)
These methods makes a protection that any user cant change the data accidentally. However, if you do not want any user that don't know password to see the data then you can use following library:
http://dotnetzip.codeplex.com/
You have a password protected zipped file that contains your excel.xlsx file by using the dotnetzip library.
An example: