Converts MS Excel Spreadsheet to PDF, image etc
Supported formats, MS Word, Excel, Powerpoint, Txt, Csv, Flash, ODT, RTF, PDF.. etc.
Here is the code:
long startTime1 = System.currentTimeMillis();
// connect to an OpenOffice.org instance running on port 8100
OpenOfficeConnection connection = new SocketOpenOfficeConnection(SocketOpenOfficeConnection.DEFAULT_PORT);
connection.connect();
DocumentConverter converter1 = new OpenOfficeDocumentConverter(connection);
File inputFile = new File("C:\\Miral\\temp\\myDocument.doc"));
File outputFile = new File("C:\\Miral\\temp\\myPortDocument.pdf");
totalFileSize+=(inputFile.length()/1024*100000)/100000;
converter1.convert(inputFile, outputFile);
System.out.println("Total File Size(kb): "+totalFileSize);
long endTime1 = System.currentTimeMillis();
System.out.println("Conversion Time: "+(endTime1-startTime1));
// close the connection
connection.disconnect();