xlWorkSheet.Cells.Locked = true;
// Locks cells in a excel Sheet
xlWorkSheet.EnableSelection =
Microsoft.Office.Interop.Excel.XlEnableSelection. xlUnlockedCells;
// Restrics selecting to only unlocked cells
xlWorkSheet.Protect("admin",false,true,true,false,false, false,false,false,false,false, false,false,false,false,false) ;
// Protects you Excel sheet with unprotect Password admin and attributes
// similar to Checkboxes as shown in the figure .
Add the above code just before saving your Excel workbook . Now export your excel and try to open it . You will get a message like "Your excel is Protected and readonly . To unlock it blah blah blah .... you will be prompted for password....." .
You might love to read this ? How to remove 'Sys' is undefined ?
Cool na !! For more ASP.NET solutions , Subscribe to my feed or click here to get updates via email






1 comments:
If you're like most modern consumers, you probably can’t afford to spend an entire paycheck on a replica handbags . For high fashion on a budget, turn to Top 1 Handbags. We specialize in meticulous replications of some of the most popular replica louis vuitton , wallets, replica bags , and other accessories. Each replica handbags is meticulously crafted to ensure years of reliable, handsome service.
Post a Comment