Bestimmen, ob die Lizenz erfolgreich geladen wurde

Bestimmen, ob die Lizenz erfolgreich geladen wurde

Der folgende Code greift auf dieWorkbook.isLicensed()-Methode vor dem Festlegen einer Lizenz und gibt false zurück. Dann lädt es die Lizenz und greift erneut auf die Eigenschaft zu, die jetzt wahr zurückgibt.

// 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());

Konsolenausgabe

Hier ist die Konsolenausgabe des obigen Beispielcodes

false

true