Skip to main content

convert excel to pdf using Open Office

1 reply [Last post]
cheo21
Offline
Joined: 2007-03-28

Hi all,

I am looking for a code in Java that uses the Open Office API/Libraries.. to read an existing Ms Excel file in OO calc and export this to PDF format.

any help will be apreciated.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
htll
Offline
Joined: 2009-02-02

A team in my comp has used this solution for converting DOC and XLS to PDF:

import officetools.OfficeFile; // available at http://www.dancrintea.ro/xls-to-pdf/
...
FileInputStream fis = new FileInputStream(new File("test.xls"));
FileOutputStream fos = new FileOutputStream(new File("test.pdf"));
OfficeFile f = new OfficeFile(fis,"localhost","8100", true);
f.convert(fos,"pdf");

All possible convertions are:
xls to pdf, html, csv
doc to pdf, html, txt, rtf