URL Basics
The following information is based on material found in:
StarOffice™ 7 Office Suite
A Sun™ ONE Software Offering
Basic Programmer's Guide
Page 74. See http://docs.sun.com/app/docs/doc/817-1826?q=StarOffice.
File Names in URL Notation
Since Apache OpenOffice is a platform-independent application, it uses URL notation (which is independent of any operating system), as defined in the Internet Standard RFC 1738 for file names. Standard file names using this system begin with the prefix file:/// followed by the local path. If the file name contains sub-directories, then these are separated by a single forward slash., not with a backslash usually used under Windows. The following path references the test.odt file in the doc directory on the C drive:.
file:///C:/doc/test.odt
To covert local file names into an URL, Apache OpenOffice provides the ConvertToUrl function. To convert an URL into a local file name, Apache OpenOffice provides the ConvertFromUrl function:
MsgBox ConvertToUrl("C:\doc\test.odt") ' supplies file:///C:/doc/test.odt MsgBox ConvertFromUrl("file:///C:/doc/test.odt") ' supplies (under Windows) c:\doc\test.odt
The example converts a local file name into a URL and displays it in a message box. It then converts a URL into a local file name and also displays this.
The Internet Standard RFC 1738, upon which this is based, permits use of the 0-9, a-z, and A-Z characters. All other characters are inserted as escape coding in the URLs. To do this, they are converted into their hexadecimal value in the ISO 8859-1 (ISO-Latin) set of characters and are preceded by a percent sign. For example, a space in a local file name therefore becomes a %20 in the URL.