حماية Cells
Contents
[
Hide
]
يصف هذا الموضوع بعض الأساليب لحماية الخلايا. يسمح استخدام هذه الأساليب للمطورين بتقييد المستخدمين من تحرير كل أو نطاق محدد من الخلايا في ورقة العمل.
حماية Cells
Aspose.Cells.GridWeb يوفر بعض التقنيات المختلفة للتحكم في مستوى الحماية على الخلايا عندما يكون عنصر التحكم فيوضع التحرير (الوضع الافتراضي). هذا يحمي الخلايا من التعديل من قبل المستخدمين النهائيين.
جعل الكل Cells للقراءة فقط
لتعيين جميع الخلايا في ورقة العمل للقراءة فقط ، قم باستدعاء أسلوب SetAllCellsReadonly الخاص بورقة العمل.
This file contains 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 reference of the worksheet that is currently active | |
GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex]; | |
// Setting all cells of the worksheet to Readonly | |
sheet.SetAllCellsReadonly(); |
جعل كل Cells قابل للتحرير
لإزالة الحماية من جميع الخلايا ، قم باستدعاء أسلوب SetAllCellsEditable الخاص بورقة العمل. هذه الطريقة لها تأثير معاكس لأسلوب SetAllCellsReadonly.
This file contains 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 reference of the worksheet that is currently active | |
GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex]; | |
// Setting all cells of the worksheet to Editable | |
sheet.SetAllCellsEditable(); |
جعل Cells المحدد للقراءة فقط
لحماية نطاق من الخلايا فقط:
- أولاً ، اجعل جميع الخلايا قابلة للتحرير عن طريق استدعاء طريقة SetAllCellsEditable.
- حدد نطاق الخلايا المطلوب حمايتها عن طريق استدعاء أسلوب SetReadonlyRange الخاص بورقة العمل. تأخذ هذه الطريقة عدد الصفوف والأعمدة لتحديد نطاق الخلايا.
This file contains 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 reference of the worksheet that is currently active | |
GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex]; | |
// Setting all cells of the worksheet to Editable first | |
sheet.SetAllCellsEditable(); | |
// Finally, Setting selected cells of the worksheet to Readonly | |
sheet.SetReadonlyRange(3, 2, 4, 1); |
جعل مختارة Cells قابلة للتحرير
لإلغاء حماية نطاق من الخلايا:
- اجعل كل الخلايا مقروءة فقط عن طريق استدعاء الأسلوب SetAllCellsReadonly.
- حدد نطاق الخلايا التي يمكن تحريرها عن طريق استدعاء أسلوب SetEditableRange الخاص بورقة العمل. تأخذ هذه الطريقة عدد الصفوف والأعمدة لتحديد نطاق الخلايا.
This file contains 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 reference of the worksheet that is currently active | |
GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex]; | |
// Setting all cells of the worksheet to Readonly first | |
sheet.SetAllCellsReadonly(); | |
// Finally, Setting selected cells of the worksheet to Editable | |
sheet.SetEditableRange(3, 2, 4, 1); |