How to convert ms-Excel file to Pdf in java?
16,322
You could use iText to create a pdf file in java and use Apache POI to access the data in the MS-EXCEL file. If you combine both, you could convert your excel file.
A raw example is given here
Also, there is this new API: You can try Aspose.Cells for Java which allows you to convert Excel file to PDF in Java applications. It doesn't require MS Office/OpenOffice etc to be installed on your development or deployment machine. It also works on both Windows and Linux platforms. The code is very simple as shown 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);
Author by
user3800534
Updated on August 07, 2022Comments
-
user3800534 almost 2 years
Because I have used
JXL api
for excel but now I want to convert it to Pdf file so please tell me how to change my code to convertexcel
topdf
? -
Konstantin V. Salikhov almost 10 years
You can try Aspose.Cells
- if you have a couple of hundred $ in your pocket, of course. -
user3800534 almost 10 yearsbut i want open source APi which convert excel to pdf at runtime because i have already create in excel file ..please suggest me