Добавление защиты Cell в рабочий лист

Защитите Cell, используя Aspose.Cells.GridDesktop

Следующий пример кода защищает все ячейки в диапазонеА1:Б1 активного листа GridDesktop. Когда вы дважды щелкните любую ячейку в этом диапазоне, вы не сможете редактировать. Это сделает эти ячейки доступными только для чтения.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Accessing the worksheet of the Grid that is currently active
Worksheet sheet = gridDesktop1.GetActiveWorksheet();
// Make sure sheet has been protected
sheet.Protected = true;
// Choose a cell range
CellRange range = sheet.CreateRange("A1", "B1");
// Set protected range area on Worksheet
sheet.SetProtected(range, true);