I am creating addin for Excel. He protects the sheets in the book:
public static void ProtectSheetUi(_Worksheet sheet, string password)
{
sheet.EnableOutlining = true;
sheet.Protect(password, Contents: true, UserInterfaceOnly: true, AllowFormattingCells: true,
AllowFormattingColumns: true, AllowFormattingRows: true);
}
But the problem is that when I close and open the book again, grouping / ungrouping does not work. This is because UserInterfaceOnly is not persistent. At the level of the workbook, I could again protect and protect the sheets when it opens. But how to achieve this with an add-in?
source
share