تحديد ما إذا تم تحميل الترخيص بنجاح
Contents
[
Hide
]
يوفر Aspose.CellsWorkbook.isLicensed ()الخاصية التي يمكنك استخدامها لتحديد ما إذا تم تحميل الترخيص بنجاح أم لا. إذا قمت باستدعاء هذه الطريقة قبل تعيين الترخيص ، فسيعود خطأ ، وإذا قمت باستدعاء هذه الطريقة بعد تعيين الترخيص ، فسيعود الأمر صحيحًا مشيرًا إلى أنه تم تحميل الترخيص بنجاح.
تحديد ما إذا تم تحميل الترخيص بنجاح
الكود التالي يصل إلىWorkbook.isLicensed ()الطريقة قبل تحديد الترخيص وإرجاع كاذبة. ثم يقوم بتحميل الترخيص والوصول إلى العقار مرة أخرى والذي يعود الآن صحيحًا.
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-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(DeterminetheLicenseLoadedSuccessfully.class); | |
// Create workbook object before setting a license | |
Workbook workbook = new Workbook(); | |
// Check if the license is loaded or not | |
// It will return false | |
System.out.println(workbook.isLicensed()); | |
// Set the license now | |
String licPath = dataDir + "Aspose.Total.lic"; | |
com.aspose.cells.License lic = new com.aspose.cells.License(); | |
lic.setLicense(licPath); | |
// Check if the license is loaded or not | |
// Now it will return true | |
System.out.println(workbook.isLicensed()); |
إخراج وحدة التحكم
هنا هو إخراج وحدة التحكم من نموذج التعليمات البرمجية أعلاه
false
true