com.aspose.cells.CellsException: java.lang.ClassCastException: [I cannot be cast to [Lcom.aspose.cells.zamq;("Based on cell "Display!A25)

Hi,

Using Aspose Cells for Java, version 19.5

While converting excel into pdf, we are encountering the following error.

**com.aspose.cells.CellsException: java.lang.ClassCastException: [I cannot be cast to [Lcom.aspose.cells.zamq;("Based on cell "Display!A25)**

Following is an executable code snippet:

   Workbook workbook = new Workbook("/Users/nitesh.kc/Documents/fullTemplate_ExcelParser.xlsx")
    workbook.calculateFormula();
    def counter = 0, remain =0
    def except = "P_Display"
    while (workbook.getWorksheets().getCount() != remain){
        if (workbook.worksheets.get(counter)?.visible == false) {
            workbook.worksheets.removeAt(counter)
        } else if (except && workbook.worksheets.get(counter)?.name != except) {
            workbook.worksheets.removeAt(counter)
        } else {
            counter++
            remain++
        }

    }
    workbook.save("/Users/nitesh.kc/Desktop/excel_after_remove_sheet1.xlsx")

    workbook = new Workbook("/Users/nitesh.kc/Desktop/excel_after_remove_sheet1.xlsx")
    ByteArrayOutputStream dstStream = new ByteArrayOutputStream();
    workbook.save(dstStream, SaveFormat.PDF);
    ByteArrayInputStream srcStream = new ByteArrayInputStream(dstStream.toByteArray());
    Document tempDocument = new Document(srcStream)
    tempDocument.save("/Users/nitesh.kc/Desktop/okayWEGo.pdf")

The excel file is attached to this topic.
fullTemplate_ExcelParser.xlsx.zip (144.8 KB)

Please let us know if anything is missing or needed for more clarification.
fullTemplate_ExcelParser.xlsx.zip (145 KB)

@NiteshCG,

Thanks for the template file and details.

Please try the latest version of Aspose.Cells for Java v22.10 ( Download | Maven ). I have tested your scenario/case a bit using the latest version and following simplest sample code, it works fine and I do not get any exception. The output Excel and PDF files are ok.
e.g.
Sample code:

Workbook workbook = new Workbook("f:\\files\\fullTemplate_ExcelParser.xlsx");
workbook.calculateFormula();
workbook.save("f:\\files\\excel_after_remove_sheet1.xlsx");
workbook = new Workbook("f:\\files\\excel_after_remove_sheet1.xlsx");
workbook.save("f:\\files\\out1.pdf", SaveFormat.PDF);
ByteArrayOutputStream dstStream = new ByteArrayOutputStream();
workbook.save(dstStream, SaveFormat.PDF);

Let us know with details if you still find the issue with latest version/fix.