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

Free Support Forum - aspose.com

How to convert Excel file into PDF (Using Eclipse)

Hi all,

I would like to convert the Excel file into PDF file but i get the error as following:
Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlException
at main.PDFConverter.main(PDFConverter.java:24)
Caused by: java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlException
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
May someone suggest better code for me to convert the Excel file to PDF format. Thanks a lot

Hi Christlynn,

Thanks for your posting and considering Aspose.Cells.

This issue does not seem to relate with Aspose.Cells as you can see, the exception is not related to Aspose.Cells but relates to some other issue relating to org.apache.xmlbeans.XmlException.

You should research on internet to find what causes this exception and try to resolve it.

The code to convert Excel file into PDF using Aspose.Cells is simple.

Java


//Instantiate a new workbook with Excel file path

Workbook workbook = new Workbook(“Book1.xls”);


//Save the document in PDF format

workbook.save(“MyPdfFile.pdf”, SaveFormat.PDF);


For more information relating to converting Excel file into PDF, please see the following documentation article for your reference.