pptx转ppt(java pptx,使用Java将文件.pptx转换为.ppt)

发布时间:2025-12-10 20:00:11 浏览次数:19

java pptx,使用Java将文件.pptx转换为.ppt-

java pptx,使用Java将文件.pptx转换为.pptIwaswonderingifsomeoneknowsawaytoconvert.pptxto.pptprogamaticallyusingJava?解决方案Youcanuseopenofficeforconversion.Youhavetoconfigureeclipse/netbeansproperly.Youneedjodconver…_javapptx转ppt

I was wondering if someone knows a way to convert .pptx to .ppt progamatically using Java?

解决方案

You can use openoffice for conversion. You have to configure eclipse/netbeans properly. You need jodconverter plugin, too.

oh, and remember to open OO in listening mode

package openofficeconv;

import java.io.File;

import java.net.ConnectException;

import com.artofsolving.jodconverter.DocumentConverter;

import com.artofsolving.jodconverter.openoffice.connection.*;

import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter;

public class PowerpointConverter{

public static void main(String[] args) {

File inputFile = new File(“j.pptx”);

File outputFile = new File(“j.pdf”);

// connect to an OpenOffice.org instance running on port 8100

OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100);

try {

connection.connect();

} catch (ConnectException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

// convert

DocumentConverter converter = new OpenOfficeDocumentConverter(connection);

converter.convert(inputFile, outputFile);

// close the connection

connection.disconnect();

}

}

需要做网站?需要网络推广?欢迎咨询客户经理 13272073477