Determinar si la licencia se cargó correctamente
Contents
[
Hide
]
Aspose.Cells proporcionaWorkbook.IsLicensed propiedad que puede utilizar para determinar si la licencia se carga correctamente o no. Si accede a esta propiedad antes de establecer la licencia, devolveráfalso si llamará a esta propiedad después de establecer la licencia, devolveráverdadero indicando que la licencia se ha cargado con éxito.
C# código para determinar si la Licencia se cargó correctamente
El siguiente código accede a laWorkbook.IsLicensed propiedad antes de establecer una licencia y vuelvefalso . Luego carga la licencia y accede nuevamente a la propiedad que ahora regresaverdadero.
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); |
Salida de consola
Aquí está la salida de la consola (depuración) del código de muestra anterior
False
True