الحصول على التحقق المطبق على خلية ما

تظهر اللقطة الفوتوغرافية التالية الملف النموذجي لمايكروسوفت إكسل المستخدم في الشيفرة البرمجية النموذجية أدناه. الخلية C1 لديها تحقق عشري مطبق ويمكنها فقط قبول القيم بين 10 و 20.

خلية ذات تحقق

todo:image_alt_text

تحصل الشيفرة النموذجية أدناه على التحقق المطبق على C1 وتقرأ خصائصها المتنوعة.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getDataDir(GetValidationAppliedonCell.class);
// Instantiate the workbook from sample Excel file
Workbook workbook = new Workbook(dataDir + "book1.xlsx");
// Access its first worksheet
Worksheet worksheet = workbook.getWorksheets().get(0);
// Cell C1 has the Decimal Validation applied on it.
// It can take only the values Between 10 and 20
Cell cell = worksheet.getCells().get("C1");
// Access the valditation applied on this cell
Validation validation = cell.getValidation();
// Read various properties of the validation
System.out.println("Reading Properties of Validation");
System.out.println("--------------------------------");
System.out.println("Type: " + validation.getType());
System.out.println("Operator: " + validation.getOperator());
System.out.println("Formula1: " + validation.getFormula1());
System.out.println("Formula2: " + validation.getFormula2());
System.out.println("Ignore blank: " + validation.getIgnoreBlank());

هنا ناتج الوحدة من الشيفرة النموذجية تم تنفيذه مع الملف النموذجي الموضح في اللقطة الفوتوغرافية أعلاه.

Reading Properties of Validation

\--------------------------------

Type: 2

Operator: 0

Formula1: =10

Formula2: =20

Ignore blank: true

مقالات ذات صلة