Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

Commented Unassigned: Locking cells doesn't work [9381]

$
0
0
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);

Viewing all articles
Browse latest Browse all 1877

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>