الحصول على التحقق المطبق على خلية ما
يمكنك استخدام Aspose.Cells لـ Node.js للحصول على التحقق المطبق على خلية. يوفر Aspose.Cells طريقة Cell.getValidation() لهذا الغرض. إذا لم يكن هناك تحقق مطبق على الخلية، فإنه يرجع null.
بالمثل، يمكنك استخدام الأسلوب Worksheet.validations.getValidationInCell(number, number) للحصول على التحقق المطبق على خلية عن طريق توفير مؤشرات الصف والعمود الخاصة بها.
كود Node.js للحصول على التحقق المطبق على خلية
يعرض لك رمز العينة التالي كيفية الحصول على التحقق المطبق على خلية.
const AsposeCells = require("aspose.cells.node"); | |
const path = require("path"); | |
// The path to the documents directory. | |
const dataDir = path.join(__dirname, "data"); | |
// Instantiate the workbook from sample Excel file | |
const workbook = new AsposeCells.Workbook(dataDir + "sample.xlsx"); | |
// Access its first worksheet | |
const worksheet = workbook.getWorksheets().get(0); | |
// Cell C1 has the Decimal Validation applied on it. It can take only the values Between 10 and 20 | |
const cell = worksheet.getCells().get("C1"); | |
// Access the validation applied on this cell | |
const validation = cell.getValidation(); | |
// Read various properties of the validation | |
console.log("Reading Properties of Validation"); | |
console.log("--------------------------------"); | |
console.log("Type: " + validation.getType()); | |
console.log("Operator: " + validation.getOperator()); | |
console.log("Formula1: " + validation.getFormula1()); | |
console.log("Formula2: " + validation.getFormula2()); | |
console.log("Ignore blank: " + validation.getIgnoreBlank()); |