Free Support Forum - aspose.com

The license has been purchased, but the watermark still exists in the generated file

When I use Aspose.Cells product, I know from the example that I have successfully set up and verified the license.The code screenshot is as follows:
image.jpg (94.6 KB)
But when I create a Workbook object, I can’t pass the license. The generated file has a watermark worksheet. Why do I still have a watermark when I purchase the license? Is it designed so? If I want to circumvent this display, is there a What other interfaces are available?This is the file I generated.
image.png (46.3 KB)

@Eziomu,

Thanks for your query.

Apparently it seems that you are using the license properly but due to whatever reason, license is not loaded before generating the workbook which is causing this issue. Please share a simplest console application(runnable) which can be compiled and executed here without any missing references. It should simply call the license and generate a simple workbook. (No need to send your license). We will check the application here and provide our feedback.

public static boolean getLicense() {
	boolean result = false;
	try {
		License lic = new License();
		lic.setLicense(WordsUtils.class.getResourceAsStream("../Aspose.Total.Java.lic"));
		if (lic.isLicensed()) {
			System.out.println("License is Set!");
		}
	} catch (Exception e) {
		e.printStackTrace();
		throw new ThrowException("msg_error",e.getMessage());
	}
	
	return result;
}

public static void main(String[] args){
	getLicense();
	try {
		Workbook book = new Workbook("D:/test001.xlsx");
		System.out.println(book.isLicensed());
		WorksheetCollection sheets = book.getWorksheets();
		Worksheet sheet = sheets.get(0);
		Cells cells = sheet.getCells();
		cells.get(0,0).setValue("--try--");
		book.save("D:/test.xlsx");
		System.out.println("---end---");
	} catch (Exception e) {
		e.printStackTrace();
	}
}

@Eziomu,

I have tested this sample code (with little changes) but could not observe any issue as workbook is created without any water mark sheet. As requested earlier please send us the complete project (a runnable console application) for our testing here. I have tried the following simple code to test the scenario, which you may also try at your end.

public static void main(String[] args) throws Exception
{
	getLicense();
	Workbook book = new Workbook("book1.xlsx");
	System.out.println(book.isLicensed());
	WorksheetCollection sheets = book.getWorksheets();
	Worksheet sheet = sheets.get(0);
	Cells cells = sheet.getCells();
	cells.get(0,0).setValue("--try--");
	book.save("book2.xlsx");
	System.out.println("---end---");
}
public static boolean getLicense() throws Exception {
	boolean result = false;
	try {
		License lic = new License();
		lic.setLicense("C:\\CellLicense\\Aspose.Total.Java.lic");
		if (License.isLicenseSet()) {
			System.out.println("License is Set!");
		}
	}
	catch (Exception e)
	{
		e.printStackTrace();
	}
	return result;
}

It is observed that you have used one wrong statement which cannot be compiled. I have modified that statement also.
Wrong code is:

if (lic.isLicensed()) {
			System.out.println("License is Set!");

Modified code is:

if (License.isLicenseSet()) {
    System.out.println("License is Set!");

Thank you, I think I found the reason! I mixed the words with cells and caused the wrong license entity to be referenced here! God, it’s stupid! Thanks again

@Eziomu,

Good to know that your issue is sorted out. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.