Am Samstag, den 31.12.2005, 18:12 -0500 schrieb Hal Vaughan:
> I have a section of code that worked fine in 1.1.x and does not work in 
> 2.x.x.  
> I keep getting the error:
> 
> com.sun.star.lang.IllegalArgumentException: URL seems to be an unsupported 
> one.
> 
> (I'd paste in code here, but it seems clear that this is a URL problem, and 
> not something else.)
> 
> I've been looking through the documentation.  While there are examples of 
> using loadComponentFromURL, it is almost impossible to find an example of an 
> actual working URL to use as a parameter or how that URL is constructed from 
> a filename.  I tried using a Java URL, creating it from a filename, and 
> getting the URL as a string, but I had to include java.net.URL and that 
> seemed to conflict with other imports (I'm still trying to figure that part 
> out).
> 
> With 1.x, when I had a filename, to convert it to a URL, I used this routine:
> 
> public String makeURL(String sFile) {
>       if (sFile.startsWith("private:factory/s")) {return sFile;}
>       if (!sFile.startsWith("/")) {sFile = "/" + sFile;}
>       if (sysConfig.getMode("osname").toLowerCase().indexOf("windows") >= 0) {
>               sFile = sFile.replace('\\', '/');
>       }
>       sFile = "file:" + sFile;
>       return sFile;
> }
> 
> It worked without any problems before, but now it isn't working.  I changed 
> the 3rd line so it would put "//" at the start of the line instead of "/" so 
> it would change from file:/ to file:// just in case, but no difference.
> 
> Seeing a few sample URLs would be a great help here.

You can transform arbitrary file locations and the like to valid URLs
like this:

sub make Url
        msgbox ConvertToUrl("your url-like string")
end sub

If you run this BASIC macro you can make your own examples. ;)

Happy new year,
Marc



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to