Invalid workbook setting in the xlsb workbook

Hi Team,
we are facing this issue when we are writing the data to excel workbook can you please help to resolve this

Caused by: java.lang.Exception: com.aspose.cells.CellsException: Invalid workbook setting in the xlsb workbook.
at com.steelwedge.ejb.reportbatchmdb.ExcelReport.createSheet1(ExcelReport.java:1537)
at com.steelwedge.ejb.reportbatchmdb.ExcelReport.addSheetsToReport(ExcelReport.java:978)
… 15 more
Caused by: com.aspose.cells.CellsException: Invalid workbook setting in the xlsb workbook.
at com.aspose.cells.zcfx.d(Unknown Source)
at com.aspose.cells.zcfx.a(Unknown Source)
at com.aspose.cells.zceq.e(Unknown Source)
at com.aspose.cells.zceq.a(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.(Unknown Source)
at com.steelwedge.ejb.reportbatchmdb.ExcelReport.createSheet1(ExcelReport.java:1532)
at com.steelwedge.ejb.reportbatchmdb.ExcelReport.addSheetsToReport(ExcelReport.java:979)
… 15 more

@e2open,

Thanks for the stack trace.

Please provide a simple console JAVA program (runnable) and attach your template (you may zip it prior attaching here) to reproduce the issue on our end, we will check it soon.

PS. Please try using our latest version/fix (if you are not already using it): Aspose.Cells for Java v18.10.x

Thanks Amjad_shai , with the latest aspose 18.9 jar this issue got resolved , but now we are getting the below warning “Evaluation Only. Created with Aspose.Cells for Java.Copyright 2003 - 2018 Aspose Pty Ltd.” we have license till April2019. How to resolve this.

@e2open,

Good to know that your issue is sorted out with some newer version.
Regarding evaluation warning/watermark, it looks like your application is either not using the latest license (which is valid till May 2019) or using some older license. So, kindly make sure your application/project is using latest license file whose subscription is not expired.

Let us know if you still find the issue, kindly do provide more details and sample code to show the issue, we will check it soon.

Hi ,

Our application has only one license file this is having the evaluation till 18 April 2019

@e2open,

It looks like your licensing code never processed. Please debug your code (you may put break points on licensing code) to check if the lines are processed in the life time of application cycle or not. Please, note, the licensing code should be processed at least once in the whole application life cycle.

HI Amjad,

Please see the lic file and the excel workbook attached we are getting the evaluation warningAsposeTest.zip (99.0 KB)

@e2open,

Where do you set the license in the code, it looks like you are not setting the license or licensing code never processed. I have tested your scenario/ case using your license file with v18.7.x, it works fine. I did set the license in code at the start of the Java program, see the sample Java program that I am using and find attached the output XLSX file for your reference. The output file does not have evaluation watermark sheet in it:
e.g
Sample code:

import java.awt.*;
import com.aspose.cells.*;
import com.aspose.cells.ChartCollection;
import com.aspose.cells.Workbook;
import com.aspose.cells.Worksheet;
import com.aspose.cells.WorksheetCollection;

public class TestLicense2 {
    
    public static void main(String... args) throws Exception {
	
	com.aspose.cells.License license = new com.aspose.cells.License();
	license.setLicense("f:\\files\\Aspose.Cells.lic");

	Workbook workbook = new Workbook();
	System.out.println(CellsHelper.getVersion());
	workbook.getWorksheets().get(0).getCells().get("A1").putValue("hello world");
	workbook.save("f:\\files\\outtestlic1.xlsx");



    }
} 

Also, see the document for your reference:

Let us know if you still have any issue or confusion.
outtestlic1.zip (5.5 KB)

Hi Amjad

Try to write to the excel workbook that i am attaching below is the sample code

public static void main(String[] args)
{
	try<a class="attachment" href="/uploads/default/20341">Private1_Audit Trail Report.zip</a> (95.2 KB)

	{
		writeDataToFile("Private1_Audit Trail Report.xlsb");
		
		
	}
	catch(Throwable e)
	{
		e.printStackTrace();
	}
}



public static void writeDataToFile(String fileName)
{
	try
	{
		
		License license = new License();
		
		String licenseFilePath =  "E:/Aspose/Aspose/lib/Aspose.Cells.lic";
		
		license.setLicense(licenseFilePath);
		
		Workbook wb=new Workbook("E:/aspose_check/data/"+fileName);
		Cells cells = null;
		
		if(wb.getWorksheets().get("sheet1")!=null)
		{
			cells =wb.getWorksheets().get("sheet1").getCells();
			System.out.println("yo1");

		}
		else
		{
			wb.getWorksheets().add("sheet1");
			cells=wb.getWorksheets().get("sheet1").getCells();
			System.out.println("yo2");
		}
		
		

		cells.get(5, 1).putValue("A");
		cells.get(5, 2).putValue("B");
		cells.get(5, 3).putValue("C");

		cells.get(6, 1).putValue("3");
		cells.get(6, 2).putValue("5");
		cells.get(6, 3).putValue("7");
		//wb.save();
		
		System.out.println(cells.get(5, 1));
		System.out.println(cells.get(5, 2));
		
		wb.save("E:/aspose_check/data/"+fileName, SaveFormat.XLSB);
		
		System.out.println("Saved excel file!!!");
	}
	catch(Throwable e)
	{
		e.printStackTrace();
	}
}

Private1_Audit Trail Report.zip (95.2 KB)

@e2open,

Thanks for the sample code and template file.

I guess I understand your issue now. For your information, your template file “Private1_Audit Trail Report.xlsb” already has evaluation watermark sheet in it, so you are expecting this worksheet will be removed from the workbook when you re-save the file (using a valid license and licensing code) after editing some cells. I am afraid, this is not possible and it should not be removed (automatically) unless you remove it manually in Ms Excel or via Aspose.Cells APIs.

In short, if an evaluation watermark worksheet is there in a spreadsheet, it will be retained when using licensing mode but no additional watermark worksheet will be added.

To check if your license is working fine or not, please remove the watermark worksheet (last sheet) in the workbook and re-save the file, now use your code with the updated template file, it will work as you expected and there would be no watermark worksheet in the output file.

Thanks for your understanding!