Java save xls file as PDF

javapdfxls

I have a simple java program that creates .xls file (open office excel file), and I want to save it as pdf. I saw some answers here but none of them worked for me. Is there a simple and free way to do so?
The file contains only 1 page of .xls

Thanks

Best Answer

Not sure, please provide more details , share code so that the answer can be more precise, but for code perspective it can be achieved via Apache POI.something like below ....

 //Instantiate a new workbook with excel file path
Workbook workbook = new Workbook("F:\\FileTemp\\Book1.xls");

//Save the document in Pdf format
workbook.save("F:\\FileTemp\\MyPdfFile.pdf", FileFormatType.PDF);