Difference between revisions of "URL Basics"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Filenames in URL Notation)
m
 
Line 1: Line 1:
The following information is based on material found in: <br> StarOffice™ 7 Office Suite <br> A Sun™ ONE Software Offering <br> Basic Programmer's Guide <br> Page 74. See http://docs.sun.com/app/docs/doc/817-1826?q=StarOffice.
+
The following information is based on material found in: <br> StarOffice™ 7 Office Suite <br> A Sun™ ONE Software Offering <br> Basic Programmer's Guide on page 74.  
 
+
  
 
=Filenames in URL Notation=
 
=Filenames in URL Notation=
Since {{AOo}} 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 filenames. Standard filenames using this system begin with the prefix '''file:///''', followed by the local path. If the filename 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:.
+
Since {{AOo}} 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 filenames. Standard filenames using this system begin with the prefix '''file:///''', followed by the local path. If the filename 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:
 
+
<syntaxhighlight lang="oobas">
 
  file:///C:/doc/test.odt
 
  file:///C:/doc/test.odt
 +
</syntaxhighlight>
  
To convert local filenames into an URL, {{AOo}} provides the ConvertToUrl function. To convert an URL into a local filename, {{AOo}} provides the ConvertFromUrl function:  
+
To convert local filenames into an URL, {{AOo}} provides the <tt>ConvertToUrl</tt> function. To convert an URL into a local filename, {{AOo}} provides the <tt>ConvertFromUrl</tt> function:  
  
<source lang="oobas">
+
<syntaxhighlight lang="oobas">
 
MsgBox ConvertToUrl("C:\doc\test.odt") ' supplies file:///C:/doc/test.odt
 
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
 
MsgBox ConvertFromUrl("file:///C:/doc/test.odt") ' supplies (under Windows) c:\doc\test.odt
</source>
+
</syntaxhighlight>
 
The example converts a local filename into a URL and displays it in a messagebox. It then converts a URL into a local filename and also displays this.  
 
The example converts a local filename into a URL and displays it in a messagebox. It then converts a URL into a local filename and also displays this.  
  

Latest revision as of 16:15, 24 August 2022

The following information is based on material found in:
StarOffice™ 7 Office Suite
A Sun™ ONE Software Offering
Basic Programmer's Guide on page 74.

Filenames 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 filenames. Standard filenames using this system begin with the prefix file:///, followed by the local path. If the filename 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 convert local filenames into an URL, Apache OpenOffice provides the ConvertToUrl function. To convert an URL into a local filename, 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 filename into a URL and displays it in a messagebox. It then converts a URL into a local filename 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 filename therefore becomes a %20 in the URL.

Personal tools