public void docToPdf() {
Date start = new Date();
OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100);
try {
connection.connect(); //执行到这里的时候报错,错误信息如下
DocumentConverter converter = new OpenOfficeDocumentConverter(
connection);
converter.convert(inputFile, outputFile);
} catch (ConnectException cex) {
cex.printStackTrace();
} finally {
// close the connection
if (connection != null) {
connection.disconnect();
connection = null;
}
}
long l = (start.getTime() - new Date().getTime());
long day = l / (24 * 60 * 60 * 1000);
long hour = (l / (60 * 60 * 1000) - day * 24);
long min = ((l / (60 * 1000)) - day * 24 * 60 - hour * 60);
long s = (l / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
java.net.ConnectException: connection failed: socket,host=localhost,port=8100,tcpNoDelay=1: java.net.ConnectException: Connection refused: connect
at com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection.connect(AbstractOpenOfficeConnection.java:79)
at bao1.JOD4DocToPDF.docToPdf(JOD4DocToPDF.java:27)
at bao1.JOD4DocToPDF.run(JOD4DocToPDF.java:56)我本机win7系统,office2010
Date start = new Date();
OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100);
try {
connection.connect(); //执行到这里的时候报错,错误信息如下
DocumentConverter converter = new OpenOfficeDocumentConverter(
connection);
converter.convert(inputFile, outputFile);
} catch (ConnectException cex) {
cex.printStackTrace();
} finally {
// close the connection
if (connection != null) {
connection.disconnect();
connection = null;
}
}
long l = (start.getTime() - new Date().getTime());
long day = l / (24 * 60 * 60 * 1000);
long hour = (l / (60 * 60 * 1000) - day * 24);
long min = ((l / (60 * 1000)) - day * 24 * 60 - hour * 60);
long s = (l / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
java.net.ConnectException: connection failed: socket,host=localhost,port=8100,tcpNoDelay=1: java.net.ConnectException: Connection refused: connect
at com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection.connect(AbstractOpenOfficeConnection.java:79)
at bao1.JOD4DocToPDF.docToPdf(JOD4DocToPDF.java:27)
at bao1.JOD4DocToPDF.run(JOD4DocToPDF.java:56)我本机win7系统,office2010
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货