Posted 13 April 2023, 7:37 am EST
When I set protect = true, users cannot resize the columns. I want users to be able to resize columns when I have protect=true on the sheet.
Is this possible?
Forums Home / Spread / Spread for WinForms
Posted by: david.sheppard on 13 April 2023, 7:37 am EST
Posted 13 April 2023, 7:37 am EST
When I set protect = true, users cannot resize the columns. I want users to be able to resize columns when I have protect=true on the sheet.
Is this possible?
Posted 13 April 2023, 4:13 pm EST
Hello David,
You can use the Protect method of the SheetView class excluding the FormatColumns option to allow the user to resize the columns.
fpSpread1.AsWorkbook().ActiveSheet.Protect(WorksheetLocks.All & ~WorksheetLocks.FormatColumns);
Regards,
Prabhat Sharma.
Posted 13 April 2023, 9:08 pm EST
Thank you for your fast response.
Your recommendation worked, but I had to add a NOT operator before the FormatColumns
Fpspread1.AsWorkbook().ActiveSheet.Protect(GrapeCity.Spreadsheet.WorksheetLocks.All And NOT(GrapeCity.Spreadsheet.WorksheetLocks.FormatColumns))
Posted 16 April 2023, 1:50 pm EST
Yes, you are right because the code we have given you is in C# and if you are using VB.net, you need to use the NOT operator.