Good morning,
if i lock a worksheet as follow
SpreadTarg.ProtectSheet(SpreadTarg.ActiveSheet, "123")
then i can select sone rows depending on the value in a column and set them as unlocked
Dim Stile As IStyle = SpreadTarg.ActiveSheet.Range(CElla.Row & ":" & CElla.Row).CellStyle
Stile.Locked = False
The problem is that in this way i can edit the cells in the unlocked row but i can not add any new row.
If modify the protection command as follow
SpreadTarg.ProtectSheet(SpreadTarg.ActiveSheet, "123", ExcelSheetProtection.InsertingRows=True)
then i can no more unlock any rows nor add new rows.
I tried also with
SpreadTarg.ProtectSheet(SpreadTarg.ActiveSheet, "123", ExcelSheetProtection.InsertingRows)
but i get the same behaviour.
Please help me,
thank You in advance
Best regards
|
//To avail Unlock and InsertRows options.
spreadsheetControl.ProtectSheet(spreadsheetControl.ActiveSheet, "123", ExcelSheetProtection.All); |
Good morning,
i tried Your scode but in that way i can also delete rows and columns while i don't wont it.
I just want to let the operator to insert rows but not to delete them.
Thank You
Good evening,
thank You for our support. In Your sample the worksheet is locked and You can add a row pressing on a button.
This is not what i need. In my case the worksheet has some rows that are completely locked and other whose cells can be edited, and this works.
More than this, i would like to be free to add rows using the standard control context menu, but at the same time i need that is not possible to add or cancel columns
waiting for Your answer,
Thank You
|
//To enable add new row,column and unlocked cells in protectedsheet
Spreadsheet.ProtectSheet(Spreadsheet.ActiveSheet, "123", ExcelSheetProtection.InsertingRows | ExcelSheetProtection.InsertingRows | ExcelSheetProtection.UnLockedCells); |