Hello,
Looks like Worksheet.Cell(i,j).Style.Protection.Locked = true does not work like intended and the field is still editable. Is there something I am missing?
Thanks
Comments: Is there a way to unlock unused cells? The example above works but any unused cells are still set to locked and are thus uneditable unless you unprotect the sheet. I would like to be able to lock the header row but still allow the user to edit or copy and paste into empty rows. There is a setting to allow row inserts (which works) but not to allow the editing of any unused cells. Here is the code i used: ws.Style.Protection.SetLocked(false); ws.Row(1).Style.Protection.SetLocked(true); ws.Protect() .SetAutoFilter(true) .SetDeleteColumns(true) .SetDeleteRows(true) .SetFormatCells(false) .SetFormatColumns(false) .SetFormatRows(false) .SetInsertColumns(false) .SetInsertHyperlinks(true) .SetInsertRows(true) .SetObjects(true) .SetSelectLockedCells(true) .SetSelectUnlockedCells(true) .SetSort(true);
Looks like Worksheet.Cell(i,j).Style.Protection.Locked = true does not work like intended and the field is still editable. Is there something I am missing?
Thanks
Comments: Is there a way to unlock unused cells? The example above works but any unused cells are still set to locked and are thus uneditable unless you unprotect the sheet. I would like to be able to lock the header row but still allow the user to edit or copy and paste into empty rows. There is a setting to allow row inserts (which works) but not to allow the editing of any unused cells. Here is the code i used: ws.Style.Protection.SetLocked(false); ws.Row(1).Style.Protection.SetLocked(true); ws.Protect() .SetAutoFilter(true) .SetDeleteColumns(true) .SetDeleteRows(true) .SetFormatCells(false) .SetFormatColumns(false) .SetFormatRows(false) .SetInsertColumns(false) .SetInsertHyperlinks(true) .SetInsertRows(true) .SetObjects(true) .SetSelectLockedCells(true) .SetSelectUnlockedCells(true) .SetSort(true);