We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to protect a control in the worksheet

I have a worksheet(please refer to the attachment.). I am able to protect user from inserting/deleting row/column. User is allowed to modified the data in the worksheet, like change the selected value for a drop down list. Everything works fine, except the checkbox. It always prompt out a “The cell or chart that you are trying to change is protected and therefor read-only” dialog and prevent user to change it. How can I get rid of this? Following is my code statement:

For Each ws As Worksheet In wb.Worksheets
For x As Integer = 3 To ws.Cells.Columns.Count - 1

If ws.Cells.GetColumnWidth(x) > 20 Then
ws.Cells.SetColumnWidth(x, 20)
ElseIf ws.Cells.GetColumnWidth(x) < 10 Then
ws.Cells.SetColumnWidth(x, 10)
End If

For Each wsColumn As Aspose.Cells.Column In ws.Cells.Columns
Dim style As Aspose.Cells.Style = wsColumn.Style
style.IsLocked = False
Dim styleFlag As StyleFlag = New StyleFlag()
styleFlag.Locked = True
wsColumn.ApplyStyle(style, styleFlag)

Dim stream As MemoryStream = New MemoryStream()
wb.Save(stream, FileFormatType.Excel2000)

I think this is caused by the “Protect(ProtectionType.All)”. But if I change this to

The inserting/deleting row/column is enabled, which is not what I need.
Does anyone has a solution for this? Please let me know.Thanks in advance.

This message was posted using Page2Forum (attachment) from Protecting Worksheets - Aspose.Cells for .NET


We have tested the mentioned issue thoroughly. It is the MS Excel generated warning message. These types of messages cannot be over written or we cannot hide. However, we have logged this issue with ID CELLSNET-21529 for further investigation.