We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

java.lang.ClassCastException: com.aspose.cells.zaes cannot be cast to com.aspose.cells.zaev

Hi,

Using Aspose Cells for Java, version 21.4.

On one of the on-premise installations of our product, we’ve observed the following exception:

Caused by: java.lang.ClassCastException: com.aspose.cells.zaes cannot be cast to com.aspose.cells.zaev
	at com.aspose.cells.zaes.a(Unknown Source)
	at com.aspose.cells.zaes.a(Unknown Source)
	at com.aspose.cells.Cell.t(Unknown Source)
	at com.aspose.cells.Cell.getFormula(Unknown Source)
	at com.aspose.cells.zakp.a(Unknown Source)
	at com.aspose.cells.zakp.b(Unknown Source)
	at com.aspose.cells.zakp.a(Unknown Source)
	at com.aspose.cells.zakf.a(Unknown Source)
	at com.aspose.cells.zakf.c(Unknown Source)
	at com.aspose.cells.zakf.a(Unknown Source)
	at com.aspose.cells.zakh.b(Unknown Source)
	at com.aspose.cells.zakd.a(Unknown Source)
	at com.aspose.cells.zaki.b(Unknown Source)
	at com.aspose.cells.zaki.a(Unknown Source)
	at com.aspose.cells.Workbook.a(Unknown Source)
	at com.aspose.cells.Workbook.save(Unknown Source)
	at com.company.product.SomeClass.saveWorkbookInternal(<our code>)

Unfortunately, we do not have a file to reproduce this at the moment.

However, perhaps based on the (unscrambled) stack trace, you will be able to determine what the potential issue might be, and if it is resolved in newer versions of Aspose Cells.

Thanks in advance,
Taras

@TarasTielkes,
First you may try the latest version and check if the issue is resolved or not. If not, I am afraid that without the sample file and runnable console application it is not possible to provide assistance based on the stack trace. You may try to manage a sample file for sharing with us as it will help us to observe the issue here and provide feedback accordingly.

@TarasTielkes,
And according to the stack trace, the issue is about formulas, especially for shared formulas or array formulas. However, without the template file to reproduce the issue, we cannot figure our what’s the root cause of this exception, maybe there are some invalid formulas in the file or Workbook.

Hi @johnson.shi,

I was able to reproduce the issue using Aspose Cells for Java, version 21.7.3.

Sample code:

LoadOptions loadOptions = new LoadOptions();
loadOptions.setLightCellsDataHandler(new MyLightCellsDataHandler());
Workbook workbook = new Workbook("input.xlsb", loadOptions);
HtmlSaveOptions saveOptions = new HtmlSaveOptions(SaveFormat.HTML);
workbook.save("output.html", saveOptions);

class MyLightCellsDataHandler implements LightCellsDataHandler {

    @Override
    public boolean startSheet(Worksheet sheet) {
        return sheet.getIndex() == 0;
    }

    @Override
    public boolean startRow(int rowIndex) {
        return true;
    }

    @Override
    public boolean processRow(Row row) {
        return true;
    }

    @Override
    public boolean startCell(int columnIndex) {
        return true;
    }

    @Override
    public boolean processCell(Cell cell) {
        return true;
    }
}

Exception thrown:

Exception in thread "main" java.lang.ClassCastException: com.aspose.cells.zaeu cannot be cast to com.aspose.cells.zaex
	at com.aspose.cells.zaeu.a(Unknown Source)
	at com.aspose.cells.zaeu.a(Unknown Source)
	at com.aspose.cells.Cell.u(Unknown Source)
	at com.aspose.cells.Cell.getFormula(Unknown Source)
	at com.aspose.cells.zakr.a(Unknown Source)
	at com.aspose.cells.zakr.b(Unknown Source)
	at com.aspose.cells.zakr.a(Unknown Source)
	at com.aspose.cells.zakh.a(Unknown Source)
	at com.aspose.cells.zakh.c(Unknown Source)
	at com.aspose.cells.zakh.a(Unknown Source)
	at com.aspose.cells.zakj.b(Unknown Source)
	at com.aspose.cells.zakj.a(Unknown Source)
	at com.aspose.cells.zakk.b(Unknown Source)
	at com.aspose.cells.Workbook.save(Unknown Source)
	at com.company.MyCode.main(MyCode.java:22)

Input file: input.zip (15.1 KB)

Kind regards,
Taras

@TarasTielkes,

Please notice, I am able to reproduce the issue as you mentioned by using your template file. I found an exception “java.lang.ClassCastException: com.aspose.cells.zaeu cannot be cast to com.aspose.cells.zaex” on saving to HTML file format. I have logged a ticket with an id “CELLSJAVA-43565” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.