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.

This topic has been moved to the related forum: com.aspose.cells.CellsException: java.lang.ClassCastException: [I cannot be cast to [Lcom.aspose.cells.zamq;("Based on cell "Display!A25) - Free Support Forum - aspose.com