Worksheet Protection - Untick Select protected cells

Dear Syncfusion,

I need to protect a worksheet using XlsIO but I am unable to find the right configuration on ExcelSheetProtection to untick this specific option on LibreOffice Calc

This is the current line of code that I am using:

sheet.Protect(passwd, ExcelSheetProtection.Objects Or ExcelSheetProtection.Scenarios Or ExcelSheetProtection.LockedCells Or ExcelSheetProtection.UnLockedCells)

Am I missing some of the ExcelSheetProtection enumeration?

Thank you

Adrian


3 Replies 1 reply marked as answer

KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team November 1, 2021 10:45 AM UTC

Hi Adrian, 

Greetings form Syncfusion. 

We suggest you to try the below modified code snippet and let us know if the issue is resolved. 

Modified Code Snippet: 

sheet.Protect(passwd, ExcelSheetProtection.Objects And ExcelSheetProtection.Scenarios And Not ExcelSheetProtection.LockedCells And ExcelSheetProtection.UnLockedCells) 

If the issue still persists, kindly share the issue reproducing sample and confirm the Syncfusion XlsIO version you are using at your end, which will be helpful for us in investigating the query and provide prompt solution at the earliest. 

Regards, 
Keerthi. 


Marked as answer

AD Adrian replied to Konduru Keerthi Konduru Ravichandra Raju November 2, 2021 09:01 AM UTC

Hi Keerthi,

this allows me to untick both of the options, I just need to prevent selection on protected cells, not on unprotected ones too.

This is the desired configuration:


But with your help I managed to find the solution

sht.Protect(passwd, ExcelSheetProtection.Objects And ExcelSheetProtection.Scenarios And Not ExcelSheetProtection.LockedCells Or ExcelSheetProtection.UnLockedCells)


Thank you

Best regards
Adrian



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team November 2, 2021 01:54 PM UTC

Hi Adrian, 

We are glad that the provided suggestion helped you. Kindly let us know if you need any further assistance. 

Regards, 
Keerthi. 


Loader.
Up arrow icon