21.08.2013 Views

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The StarDesktop 77<br />

' supplies (under Windows) c:\doc\test.odt<br />

The example converts a local file name into a URL and displays it in a message box. It then<br />

converts a URL into a local file name and also displays this.<br />

The Internet Standard RFC 1738, upon which this is based, permits use of the 0-9, a-z, and<br />

A-Z characters. All other characters are inserted as escape coding in the URLs. To do this,<br />

they are converted into their hexadecimal value in the ISO 8859-1 (ISO-Latin) set of<br />

characters and are preceded by a percent sign. A space in a local file name therefore, for<br />

example, becomes a %20 in the URL.<br />

XML File Format<br />

<strong>OpenOffice</strong>.<strong>org</strong> documents are based on the XML file format. XML-based files can be<br />

opened and edited with other programs.<br />

Compression of Files<br />

Since XML is based on standard text files, the resultant files are usually very large.<br />

<strong>OpenOffice</strong>.<strong>org</strong> therefore compresses the files and saves them as a ZIP file. By means of a<br />

storeAsURL method option, the user can save the original XML files directly. See<br />

storeAsURL Method Options, below.<br />

Creating, Opening and Importing Documents<br />

Documents are opened, imported and created using the method<br />

StarDesktop.loadComponentFromURL(URL, Frame, SearchFlags,<br />

FileProperties)<br />

The first parameter of loadComponentFromURL specifies the URL of the associated file.<br />

As the second parameter, loadComponentFromURL expects a name for the frame object of<br />

the window that <strong>OpenOffice</strong>.<strong>org</strong> creates internally for its administration. The predefined<br />

_blank name is usually specified here, and this ensures that <strong>OpenOffice</strong>.<strong>org</strong> creates a new<br />

window. Alternatively, _hidden can also be specified, and this ensures that the<br />

corresponding document is loaded but remains invisible.<br />

Using these parameters, the user can open a <strong>OpenOffice</strong>.<strong>org</strong> document, since place holders<br />

(dummy values) can be assigned to the last two parameters:<br />

Dim Doc As Object<br />

Dim Url As String<br />

Dim Dummy() 'An (empty) array of PropertyValues<br />

Url = "file:///C:/test.odt"<br />

Doc = StarDesktop.loadComponentFromURL(Url, "_blank", 0, Dummy)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!