Hello,
We upgraded from version 4.2.0.12 to 4.4.1.15 of Aspose.Cells. This code worked before the update:
' Instantiate an Workbook object that represents an Excel file
Dim newWorkbook As Workbook = New Workbook()
With newWorkbook.Worksheets(0)
' Set worksheet protection level - where locked cells are not allowed to be edited
.Protection.IsEditingContentsAllowed = False
' Import datatable to worksheet
.Cells.ImportDataTable(aDataTable, True, "A1")
' Set column properties
.Cells.Columns(0).Style.IsLocked = True ' Can't be edited
.Cells.SetColumnWidth(0, 0)
.Cells.Columns(1).Style.IsLocked = False
.Cells.SetColumnWidth(1, 80)
.Cells.Columns(2).Style.IsLocked = False
.Cells.SetColumnWidth(2, 80)
' Set source language header properties
With .Cells(0, 1).Style
.IsLocked = True ' Can't be edited
.BackgroundColor = Color.LightGray
End With
' Set target language header properties
With .Cells(0, 2).Style
.IsLocked = True ' Can't be edited
.BackgroundColor = Color.LightGray
End With
End With
' Save to excel file
newWorkbook.Save(strFilePath)
After the upgrade this code generates a excel file that protects all cells, even tough only one column and two cells is locked(IsLocked = true). With other words the hole worksheet are protected now.
Waiting for your response.
thanks in advance,
Sincerely,
Masod Saidi