Posted 24 April 2023, 5:28 am EST
- Updated 24 April 2023, 6:05 am EST
Hi,
Thanks for reaching out to us with your query.
You can easily create a Pdf file through an Excel document using GCExcel library.
public class Main
{
public static void main(String[] args) throws Exception {
// Create a new workbook
Workbook workbook = new Workbook();
// Open an excel file
InputStream fileStream = new FileInputStream("EmployeeData.xlsx");
workbook.open(fileStream);
// Save to an pdf file
workbook.save("ConvertExcelToPDF.pdf");
}
To resolve these type of errors, make sure all dependencies are added to the project. You can refer here: for all GCExcel Java dependencies: https://www.grapecity.com/documents-api-excel-java/docs/online/getting-started.html
Please refer the working GCExcel Java sample to create Pdf through an Excel document:
ConvertExcelToPDF_java.zip
You can get back to us if you face any other issues.
Best Regards,
Nitin