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

Free Support Forum - aspose.com

Export pdf but throw CellsException

I used cells to export pdf like this code, but I got CellsException, code = 4. I change to export xps, it’s success .
I try with cells 18.10 and 18.11

  try {
            Workbook wb = new Workbook("p1.xlsm");
            for (Object o : wb.getWorksheets()) {
                Worksheet ws = (Worksheet) o;
                if ("A_Sum.2".equals(ws.getName())) {
                    ws.setVisible(true);
                } else {
                    ws.setVisible(false);
                }
            }
            wb.save("D:/sum.pdf", SaveFormat.PDF);

            wb.dispose();
        } catch (CellsException e) {
            int code = e.getCode();
            System.out.println(code);
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }

@i2534,

Thanks for your query.

Please share your sample Excel file with us for our testing. We will reproduce the problem and provide our feedback after analysis.

@ahsaniqbalsidiqui
wb.zip (274.6 KB)
This sheet is copy from a big xlsm, only this sheet throw exception

@i2534,

Thanks for providing us template file.

After an initial test, I am able to observe the issue as you mentioned by using your sample code with your template file. I found an exception “4com.aspose.cells.CellsException” when rendering the Excel file to PDF file format:
e.g
Sample code:

try {
            Workbook wb = new Workbook("f:\\files\\wb.xlsx");
            for (Object o : wb.getWorksheets()) {
                Worksheet ws = (Worksheet) o;
                //if ("A_Sum.2".equals(ws.getName())) {
                  //  ws.setVisible(true);
                //} else {
                  //  ws.setVisible(false);
                //}
            }
            wb.save("f:\\files\\outsumasdfasdfasdf.pdf", SaveFormat.PDF);

            wb.dispose();
        } catch (CellsException e) {
            int code = e.getCode();
            System.out.println(code);
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }

I have logged a ticket with an id “CELLSJAVA-42765” for your issue. We will look into it soon.

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

@Amjad_Sahi
Today I test export to tiff, or using SheetRender.toImage png, it also throw CellsException, but my catch code not catch this exception, only can found in debug, breadpoint at CellsException…

@i2534,

I have been able to notice the problem so I have logged your concern with the logged ticket. We will provide our feedback once some updates are ready to share.

@i2534,

This is to inform you that we have fixed your issue (logged earlier as “CELLSJAVA-42765”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

@i2534,

Please try our latest version/fix: Aspose.Cells for Java v118.11.4 (attached)

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells for Java_v18.11.4.zip (6.3 MB)

@Amjad_Sahi
Yes, It’s OK. this version fixed all problems.
Thank you!

@i2534,

Good to know that your issue is sorted out by the new fix/version. 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.

The issues you have found earlier (filed as ) have been fixed in Aspose.Cells for Java 18.12. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi