Java save xls file as PDF

早过忘川 提交于 2020-01-17 02:54:05

问题


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


回答1:


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);


来源:https://stackoverflow.com/questions/39572244/java-save-xls-file-as-pdf

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!