Sascha Holzhauer wrote:
Hello,
I've written a short Java-programm to extract some information out of a
spreadsheet. The spreadsheet is chooseable by a JFileChooser. It worked
well until OOo 1.3. With OOo 2.0.2 I get the error:
See
http://api.openoffice.org/docs/common/ref/com/sun/star/uri/ExternalUriReferenceTranslator.html
and
http://api.openoffice.org/docs/common/ref/com/sun/star/uri/XExternalUriReferenceTranslator.html#translateToInternal.
In short, OOo distinguishes between "internal" and "external" URIs,
where Java's URIs are external, so code like
String path2 = com.sun.star.uri.ExternalUriReferenceTranslator.
create(context).translateToInternal(path);
if (path2.length() == 0 && path.length() != 0) {
throw new RuntimeException();
}
is needed to translate path into path2 before using it. (And that it
worked in OOo 1.3 was by chance, not by design.)
-Stephan
com.sun.star.lang.IllegalArgumentException: URL seems to be an
unsupported one.
at
com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException(Job.java:275)
at com.sun.star.lib.uno.environments.remote.Job.execute(Job.java:141)
at
com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:377)
at
com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:346)
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:860)
at
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:809)
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 $Proxy3.loadComponentFromURL(Unknown Source)
at BestandsSQLBuilder20.useConnection(BestandsSQLBuilder20.java:103)
at BestandsSQLBuilder20.main(BestandsSQLBuilder20.java:47)
String path = fileChoose.getSelectedFile().toURI().toString();
Code :
<------
PropertyValue[] loadProps = new PropertyValue[1];
loadProps[0] = new PropertyValue();
loadProps[0].Name = "Hidden";
loadProps[0].Value = new Boolean(true);
XComponent xSpreadsheetComponent =
xComponentLoader.loadComponentFromURL(
path, "_blank", 0, loadProps);
----->
Thanks for your effort!
Sascha Holzhauer
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]