79101373

Date: 2024-10-18 09:15:45
Score: 0.5
Natty:
Report link

The answer was to use the AutoFilter option on the Protect command (I also need to allow FormatCells and InsertColumns for another requirement).

exWS.Columns().AdjustToContents();
exWS.RangeUsed().SetAutoFilter();
exWS.Protect().AllowElement(XLSheetProtectionElements.FormatCells)
              .AllowElement(XLSheetProtectionElements.InsertColumns)
              .AllowElement(XLSheetProtectionElements.AutoFilter);
exWS.Column("B").Style.Protection.SetLocked(false);
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Pro West