Agregar protección en la hoja de cálculo
Contents
[
Hide
]
Aspose.Cells for GridDesktop le permite proteger celdas en una hoja de cálculo. Primero debe proteger su hoja de cálculo, luego puede proteger las celdas deseadas en la hoja de cálculo. Para proteger la hoja de cálculo, configure la propiedad Worksheet.Protected en true, luego utilice el método Worksheet.SetProtected() para proteger el rango de celdas.
Proteger celda usando Aspose.Cells.GridDesktop
El siguiente código de ejemplo protege todas las celdas en el rango A1:B1 de la hoja de cálculo activa de GridDesktop. Cuando haga doble clic en cualquier celda en este rango, no podrá editarla. Estas celdas serán de solo lectura.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |