how can protect our ms excel sheet.

Posted by Bageshkumarbagi under Others on 11/4/2012 | Points: 10 | Views : 1070 | Status : [Member] | Replies : 3
hi
I want to protect my excel sheet .plz help me.

Thanks,
Bagesh Kumar Singh
Mark as answer if you have been satisfied



Responses

Posted by: Eva2012 on: 11/5/2012 [Member] Starter | Points: 25

Up
0
Down
You can use below code to lock excel worksheet as well as encrypt your whole excel file:
lock excel worksheet c#:
             Workbook workbook = new Workbook();

workbook.LoadFromFile(@"D:\lock worksheet.xls");
workbook.Worksheets(0).Range.Style.Locked = true;
workbook.Worksheets(1).Range.Style.Locked = true;
workbook.SaveToFile("result.xls");


encrypt Excel file c#:

Worksheet sheet = workbook.Worksheets[0];
sheet.Protect("password", SheetProtectionType.InsertingColumns);
workbook.SaveToFile("Protected.xlsx");

but as your case, lock excel worksheet seems more suitable, so you can choose the first method. you can see details here:
http://excelcsharp.blog.com/category/net/excel-security/lock-worksheet/

Bageshkumarbagi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajesh081725 on: 11/5/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi Eva,

Where i can use this encrypted code can u give other examples

Time is Gold
Thanks & Regards,
Rajesh Kumar,
9962038582.

Bageshkumarbagi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Eva2012 on: 11/6/2012 [Member] Starter | Points: 25

Up
0
Down
If you want to protect all the excel worksheets, you can protect this excel file by setting passwords. while if you have three worksheets in your excel file, you just want to protect one, you can lock that excel worksheet, thus, no one can modify your data in excel worksheet, but this locked worksheet still can be read by others. in one word, want the excel not be seen by others, use the encrypt function, enales to view while not modify, use the lock function.

Bageshkumarbagi, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response