العمل مع عمليات التحقق من الصحة في الأعمدة
Contents
[
Hide
]
في أحد موضوعاتنا السابقة ، ناقشنا حول عمليات التحقق ولكن كان ذلك في سياقعمليات التحقق من الصحة في أوراق العمل (للحصول على معلومات عامة حول أوضاع التحقق والتحقق ، يمكن للمطورين الرجوع إلى هذا الموضوع). في هذا الموضوع ، سنشرح عمليات التحقق من الصحة فيما يتعلق بالأعمدة. باستخدام هذه الميزة ، يمكن للمطورين تطبيق قاعدة التحقق من الصحة على أي عمود في ورقة العمل. دعونا نناقشها بالتفصيل.
إضافة التحقق من صحة العمود
لإضافة أي نوع من التحقق إلى عمود ، يرجى اتباع الخطوات التالية:
- أضف Aspose.Cells.GridDesktop control إلى ملفاستمارة
- الوصول إلى أي ملفاتورقة عمل
- يضيف المطلوبتصديق إلى أي عمود
الأهمية:لمزيد من المعلومات حول أنواع التحقق من الصحة (أو أوضاع التحقق مثلمطلوب التحقق من الصحة, التحقق من صحة التعبيرات العادية والتحقق المخصص ) والتنفيذالتحقق المخصص ، يرجى الرجوع إلىالعمل مع عمليات التحقق من الصحة في أوراق العمل.
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 first worksheet of the Grid | |
Worksheet sheet = gridDesktop1.Worksheets[0]; | |
// Adding Is Required Validation to a column | |
sheet.Columns[2].AddValidation(true, ""); | |
// Adding simple Regular Expression Validation to a column | |
sheet.Columns[4].AddValidation(true, @"\d+"); | |
// Adding complex Regular Expression Validation to a column | |
sheet.Columns[6].AddValidation(true, @"\d{4}-\d{2}-\d{2}"); | |
// Adding Custom Validation to a column | |
sheet.Columns[8].AddValidation(new CustomValidation()); |
الوصول إلى التحقق من العمود
للوصول إلى التحقق من عمود معين ، يرجى اتباع الخطوات أدناه:
- قم بالوصول إلى ملفورقة عمل
- الوصول إلى عمود محددتصديق في الورقة عمل
- تعديلتصديق السمات ، إذا رغبت في ذلك
//Accessing first worksheet of the Grid
Worksheet sheet = gridDesktop1.Worksheets[0];
//Accessing the Validation object applied on a specific column
Validation validation = sheet.Columns[2].Validation;
//Editing the attributes of Validation
validation.IsRequired = true;
validation.RegEx = "";
validation.CustomValidation = null;
إزالة التحقق من العمود
لإزالة التحقق من عمود معين من ورقة العمل ، يرجى اتباع الخطوات التالية:
- قم بالوصول إلى ملفورقة عمل
- قم بإزالة عمود معينتصديق منورقة عمل
//Accessing first worksheet of the Grid
Worksheet sheet = gridDesktop1.Worksheets[0];
//Removing the Validation applied on a specific column
sheet.Columns[2].RemoveValidation();