Hi Stephan,
>>>> Construction of URL's isnt realy platform independend here. You should
>>>> the JAVA classes File/URL/URI to create real URL's.
>>>> But be aware of a bug inside these JAVA classes. They construct file
>>>> URL's like "file:/test/file.txt", which does not represent valid file
>>>> URLs. You have to establish a workaround for that and convert "file:/"
>>>> hardly to "file:///".
>> it tool a while till I found in the web how to use this class... I
>> solved it this way:
>> -----%<-----
>> // Conditions XComponentContext xRemoteContext = Bootstrap.bootstrap();
>>
>> java.io.File newfile = new java.io.File("/tmp/test.odt");
>> java.net.URL before = null;
>> try
>> {
>> before = newfile.toURL();
>> }
>> catch (MalformedURLException e) {
>> System.out.println(e);
>> }
>> // Create a URL, which can be used by UNO
>> String myUNOFileURL = ExternalUriReferenceTranslator
>> .create(xRemoteContext).translateToInternal(before.toExternalForm());
>> -----%<-----
>>
>> Thanks for the hint. This is now a really good solution :-)
>
>
> You might also want to add some error handling, see the fine print at
> <http://api.openoffice.org/docs/common/ref/com/sun/star/uri/XExternalUriReferenceTranslator.html#translateToInternal>:
>
>
> String s1 = before.toExternalForm();
> String s2 = ExternalUriReferenceTranslator.create(xRemoteContext).
> translateToInternal(s1);
> if (s2.equals("") && !s1.equals("")) {
> // s1 cannot be translated...
> }
you're right. You already suggested it before. I added it to the snippet.
Greetings, Tobias
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]