ライセンスが正常に読み込まれているかどうかを判断する
Contents
[
Hide
]
Aspose.Cells は、ライセンスが正常にロードされたかどうかを判断するために使用できる Workbook.isLicensed() プロパティを提供します。ライセンスを設定する前にこのメソッドを呼び出すと false を返し、ライセンスを設定した後にこのメソッドを呼び出すと true を返します。これにより、ライセンスが正常にロードされたことが示されます。
ライセンスが正常にロードされたかどうかを判断する
以下のコードは、ライセンスを設定する前に Workbook.isLicensed() メソッドにアクセスして false を返し、その後ライセンスをロードしてプロパティに再度アクセスすると true を返します。
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