This works ...
public static void bootstrap() {
String loadUrl = "file:///c:/dev/netbeans/oootest/viewtopic.php.htm";
// String loadUrl = "
http://www.google.com";
String storeUrl = "file:///c:/dev/netbeans/oootest/mydocoutputboot.doc";
try {
XComponentContext xContext = Bootstrap.bootstrap();
XMultiComponentFactory xMultiComponentFactory = xContext.getServiceManager();
XComponentLoader xcomponentloader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, xMultiComponentFactory.createInstanceWithContext("com.sun.star.frame.Desktop", xContext));
PropertyValue[] conversionProperties = new PropertyValue[2];
conversionProperties[0] = new PropertyValue();
conversionProperties[0].Name = "FilterName";
conversionProperties[0].Value = "MS Word 97";
conversionProperties[1] = new PropertyValue();
conversionProperties[1].Name = "Hidden";
conversionProperties[1].Value = new Boolean(true);
// Object objectDocumentToStore = xcomponentloader.loadComponentFromURL(loadUrl, "_blank", 1, new PropertyValue[0]);
Object objectDocumentToStore = xcomponentloader.loadComponentFromURL(loadUrl, "_blank", 1, conversionProperties);
XStorable xstorable = (XStorable) UnoRuntime.queryInterface(XStorable.class, objectDocumentToStore);
// xstorable.storeToURL(storeUrl,conversionProperties);
xstorable.storeToURL(storeUrl, conversionProperties);
// Getting the method dispose() for closing the document
// XComponent xcomponent =
// ( XComponent ) UnoRuntime.queryInterface( XComponent.class,
// xstorable );
System.exit(0);
}
catch (java.lang.Exception e) {
e.printStackTrace();
}
finally {
System.exit(0);
}
}
and this does not ...
public static void bootstrap() {
String loadUrl = "http://www.xyz.com";
String storeUrl = "file:///c:/dev/netbeans/oootest/mydocoutputboot.doc";
try {
XComponentContext xContext = Bootstrap.bootstrap();
XMultiComponentFactory xMultiComponentFactory = xContext.getServiceManager();
XComponentLoader xcomponentloader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, xMultiComponentFactory.createInstanceWithContext("com.sun.star.frame.Desktop", xContext));
PropertyValue[] conversionProperties = new PropertyValue[2];
conversionProperties[0] = new PropertyValue();
conversionProperties[0].Name = "FilterName";
conversionProperties[0].Value = "MS Word 97";
conversionProperties[1] = new PropertyValue();
conversionProperties[1].Name = "Hidden";
conversionProperties[1].Value = new Boolean(true);
// Object objectDocumentToStore = xcomponentloader.loadComponentFromURL(loadUrl, "_blank", 1, new PropertyValue[0]);
Object objectDocumentToStore = xcomponentloader.loadComponentFromURL(loadUrl, "_blank", 1, conversionProperties);
XStorable xstorable = (XStorable) UnoRuntime.queryInterface(XStorable.class, objectDocumentToStore);
// xstorable.storeToURL(storeUrl,conversionProperties);
xstorable.storeToURL(storeUrl, conversionProperties);
// Getting the method dispose() for closing the document
// XComponent xcomponent =
// ( XComponent ) UnoRuntime.queryInterface( XComponent.class,
// xstorable );
System.exit(0);
}
catch (java.lang.Exception e) {
e.printStackTrace();
}
finally {
System.exit(0);
}
}
Exception thrown ...
com.sun.star.task.ErrorCodeIOException:
at com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException(Job.java:187)
at com.sun.star.lib.uno.environments.remote.Job.execute(Job.java:153)
at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:349)
at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:318)
at com.sun.star.lib.uno.environments.remote.JavaThreadPool.enter(JavaThreadPool.java:106)
at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:657)
at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.request(ProxyFactory.java:159)
at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.invoke(ProxyFactory.java:141)
at $Proxy5.storeToURL(Unknown Source)
at com.vtech.util.word.InterprocessConnectionOdtToPdfQuickAndDirty.bootstrap(InterprocessConnectionOdtToPdfQuickAndDirty.java:115)
at com.vtech.util.word.InterprocessConnectionOdtToPdfQuickAndDirty.main(InterprocessConnectionOdtToPdfQuickAndDirty.java:134)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:86)