ライセンスが正常にロードされたかどうかの判断

ライセンスが正常に読み込まれたかどうかを判断するための C# コード

次のコードは、Workbook.IsLicensedライセンスを設定する前にプロパティを返し、それが返されます間違い.次に、ライセンスをロードし、再びプロパティにアクセスします。真実.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the License File
string licPath = @"Aspose.Cells.lic";
// Create workbook object before setting a license
Workbook workbook = new Workbook();
// Check if the license is loaded or not. It will return false
Console.WriteLine(workbook.IsLicensed);
try
{
Aspose.Cells.License lic = new Aspose.Cells.License();
lic.SetLicense(licPath);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
// Check if the license is loaded or not. Now it will return true
Console.WriteLine(workbook.IsLicensed);

コンソール出力

上記のサンプル コードのコンソール (デバッグ) 出力は次のとおりです。

False

True