We are encountering an issue with Aspose.Cells for .NET where the “Evaluation Only” watermark persists in our generated Excel files despite setting a valid license. I
Despite setting the Aspose.Cells license successfully, and receiving confirmation messages such as “Aspose.Cells License set successfully,” “Workbook is licensed,” and “Excel file saved successfully at: C:\Users\GN127RT\source\repos\WebApplication1\WebApplication1\MyBook_out.xlsx,” the output Excel file still has a watermark.
The license file is located correctly and the path is verified in the code. Additionally, I ran a basic console application locally with the same license file, but the issue persists, and the watermark still appears. Below is the relevant code snippet for reference. Any insights or solutions to resolve this issue would be greatly appreciated. Thank you!
Below is the code for the dummy webapp:
using Aspose.Cells;
using System;
using System.Web.UI;
namespace WebApplication1
{
public partial class _Default : Page
{
private void SetAsposeCellsLicense()
{
try
{
// Create a License object
License license = new License();
// Set the license of Aspose.Cells to avoid the evaluation limitations
string licensePath = @"C:\Users\GN127RT\source\repos\WebApplication1\WebApplication1\Aspose.Cells.lic";
if (System.IO.File.Exists(licensePath))
{
license.SetLicense(licensePath);
System.Diagnostics.Debug.WriteLine("Aspose.Cells License set successfully.");
}
else
{
System.Diagnostics.Debug.WriteLine("Aspose.Cells License file not found: " + licensePath);
}
}
catch (Exception ex)
{
// Log the exception message
System.Diagnostics.Debug.WriteLine("Aspose.Cells License Error: " + ex.Message);
}
}
protected void Page_Load(object sender, EventArgs e)
{
SetAsposeCellsLicense();
// Instantiate a Workbook object that represents an Excel file.
Workbook wb = new Workbook();
// Check if the workbook is created in evaluation mode
if (wb.IsLicensed)
{
System.Diagnostics.Debug.WriteLine("Workbook is licensed.");
}
else
{
System.Diagnostics.Debug.WriteLine("Workbook is in evaluation mode.");
}
// When you create a new workbook, a default "Sheet1" is added to the workbook.
Worksheet sheet = wb.Worksheets[0];
// Access the "A1" cell in the sheet.
Cell cell = sheet.Cells["A1"];
// Input the "Hello World!" text into the "A1" cell
cell.PutValue("Hello World!");
// Save the Excel file.
string outputPath = @"C:\Users\GN127RT\source\repos\WebApplication1\WebApplication1\MyBook_out.xlsx";
wb.Save(outputPath);
System.Diagnostics.Debug.WriteLine("Excel file saved successfully at: " + outputPath);
}
}
}
`