Je veux faire un document convertir fonctionne utiliser jodconverter & ouvert bureau 4. J'ai installé ouvert bureau sur mes fenêtres 7 à C: \ Program Files (x86) \ OpenOffice 4. dans la tâche mgr je l'ai vu le processus de soffice.bin * 32org.artofsolving.jodconverter.office.OfficeException: n'a pas pu charger le document: asdf.doc
quand je lance ma démo pour convertir un fichier doc en html file.I a eu lieu cette exception:
log4j:WARN No appenders could be found for logger (org.artofsolving.jodconverter.office.OfficeManager).
log4j:WARN Please initialize the log4j system properly.
一月 07, 2016 10:27:49 上午 org.artofsolving.jodconverter.office.OfficeConnection connect
信息: connected: 'socket,host=127.0.0.1,port=8100,tcpNoDelay=1'
Exception in thread "main" org.artofsolving.jodconverter.office.OfficeException: could not load document: asdf.doc
at org.artofsolving.jodconverter.AbstractConversionTask.loadDocument(AbstractConversionTask.java:93)
at org.artofsolving.jodconverter.AbstractConversionTask.execute(AbstractConversionTask.java:53)
at org.artofsolving.jodconverter.office.ExternalOfficeManager.execute(ExternalOfficeManager.java:70)
at org.artofsolving.jodconverter.OfficeDocumentConverter.convert(OfficeDocumentConverter.java:72)
at org.artofsolving.jodconverter.OfficeDocumentConverter.convert(OfficeDocumentConverter.java:63)
at demo.OfficeDocumentManager.conveterOfficeDocument(OfficeDocumentManager.java:84)
at demo.Test.main(Test.java:9)
Je vérifie le code source de jodconverter:
private XComponent loadDocument(OfficeContext context, File inputFile) throws OfficeException {
if (!inputFile.exists()) {
throw new OfficeException("input document not found");
}
XComponentLoader loader = cast(XComponentLoader.class, context.getService(SERVICE_DESKTOP));
Map<String,?> loadProperties = getLoadProperties(inputFile);
XComponent document = null;
try {
document = loader.loadComponentFromURL(toUrl(inputFile), "_blank", 0, toUnoProperties(loadProperties));
} catch (IllegalArgumentException illegalArgumentException) {
throw new OfficeException("could not load document: " + inputFile.getName(), illegalArgumentException);
} catch (ErrorCodeIOException errorCodeIOException) {
throw new OfficeException("could not load document: " + inputFile.getName() + "; errorCode: " + errorCodeIOException.ErrCode, errorCodeIOException);
} catch (IOException ioException) {
throw new OfficeException("could not load document: " + inputFile.getName(), ioException);
}
if (document == null) {
throw new OfficeException("could not load document: " + inputFile.getName());
}
return document;
}
lorsque je débogue ces codes. Je trouve le document toujours nul. le fichier que je veux charger ici est existe et lisible. Quelqu'un m'a dit pourquoi je ne peux pas charger le fichier ??
Je trouve si je change le fichier doc en tant que fichier docx, je peux le charger.so cette question est pourquoi Open Office ne peut pas charger le fichier doc –