Determinare se la licenza è stata caricata correttamente
Contents
[
Hide
]
Aspose.Cells fornisceWorkbook.Is Licensed proprietà che è possibile utilizzare per determinare se la licenza è stata caricata correttamente o meno. Se accedi a questa proprietà prima di impostare la licenza, torneràfalso se chiamerai questa proprietà dopo aver impostato la licenza, torneràVERO indicando che la licenza è stata caricata correttamente.
C# per determinare se la licenza è stata caricata correttamente
Il codice seguente accede aWorkbook.Is Licensed proprietà prima di impostare una licenza e restituiscefalso . Quindi carica la licenza e accede nuovamente alla proprietà che ora ritornaVERO.
This file contains 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-.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); |
Uscita console
Ecco l’output della console (debug) del codice di esempio precedente
False
True