I have a temporary license for Aspose.Cells, and I’ve included it as an embedded resource in my project (see attached screenshot).
In my application, I initialize that license like this:
namespace Vbs.Isfa.Business.Import {
public class ImportFileValidator {
…
public ImportFileValidator(PruefungsSessionManager pruefungsSessionManager) {
// Instantiate the License class
License license = new License();
// Pass only the name of the license file embedded in the assembly
license.SetLicense(“Aspose.Cells.lic”);
}
}
}
However, that doesn’t seem to work - I still get the extra worksheet with the “This was created with a trial of Aspose.Cells” warning and all.
How do I need to reference the “Aspose.Cells.lic” file?
* like I did - just the file name?
* with the full assembly-level hierarchy, e.g.
license.SetLicense(“Vbs.Isfa.Business.License.Aspose.Cells.lic”);
* something else entirely?
I’d really prefer to have the *.lic file as an embedded resource - not a “on-disk” file
Hi Marc,
- After setting the license in your application, please check if the license has been set properly by using the Workbook.IsLicensed property. If the aforementioned property returns false that either means that the statements to set the license have not been executed or the License.SetLicense method has not thrown any exception (or exception was not captured).
- If the License.SetLicense has thrown any exception then please share the complete error details for further investigation.
- Please give a try to the latest version of Aspose.Cells for .NET 9.0.1 (attached).
using (Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(“.Aspose.Total.lic”))
{
l.SetLicense(stream);
}
Aspose.Cells.License clic = new AsposeCells.License();
clic.SetLicense(“Aspose.Total.lic”);
Sorry - my bad - the call to “license.SetLicense()” wasn’t called in all cases in my code. Once I made sure the call really happened, everything worked out fine.
Is there any harm in making that call multiple times?
Hi Marc,