Sheets and styles can be locked. By default, sheets are unlocked and styles are locked. This combination allows users to edit the cells in Excel.
To protect a cell against editing in Excel, both the sheet and the cell style must have the Locked property set to true.
To lock most cells on a sheet and allow editing of only a few cells, lock the sheet, then create an unlocked style and assign it to the cells that should be editable.
// start with a single locked sheet _c1xl.Clear(); XLSheet sheet = _c1xl.Sheets[0]; sheet.Locked = true; // create an unlocked style XLStyle dataEntry = new XLStyle(_c1xl); dataEntry.Locked = false; dataEntry.BackColor = Color.Beige; // create data entry titles sheet[0,0].Value = "Name:"; sheet[1,0].Value = "Address:"; sheet[2,0].Value = "Phone #:"; create data entry cells (unlocked) sheet[0,1].Style = dataEntry; sheet[1,1].Style = dataEntry; sheet[2,1].Style = dataEntry; // save the book _c1xl.Save(@"c:\temp\Protected.xls");