vb.net - Protecting columns in excel using C# -


i attempting write excel sheet data , after writing in necessary data, protect cells against editing making them non editable. after operation, data updated on unprotected cells sheet users use , read carry out processing activity.

  1. can me out specifically, how lock column editing in excel?
  2. how write using c# protected column?
  3. how read using c# protected column?

simple references examples me out greatly. ps: if more comfortable vb.net references of how on helpful.

for excel cell in non-editable mode 2 things have taken care of:

1) excel cell should locked

ws.get_range("location", type.missing).locked = true;

2) excel worksheet should locked

ws.protect("securitycode", true, true, true,             type.missing, type.missing, true, true, type.missing,             type.missing, type.missing, type.missing, type.missing, type.missing,             type.missing, type.missing); //where ws worksheet object 

for second question read through protected cell, can done directly

string cellvalue = ws.get_range("location", type.missing).value2.tostring(); //now depending upon cellvalue can write own logic. 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -