21.08.2013 Views

OpenOffice.org BASIC Guide - OpenOffice.org wiki

OpenOffice.org BASIC Guide - OpenOffice.org wiki

OpenOffice.org BASIC Guide - 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<br />

MsgBox "Press OK to display the second document."<br />

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

Doc = StarDesktop.loadComponentFromURL(Url, "MyFrame", _<br />

SearchFlags, Dummy)<br />

The example first opens the test.odt file in a new window with the frame name of MyFrame. Once the message<br />

box has been confirmed, it replaces the content of the window with the test2.odt file.<br />

loadComponentFromURL Method Options<br />

The fourth parameter of the loadComponentFromURL function is a PropertyValue data field. which provides<br />

<strong>OpenOffice</strong>.<strong>org</strong> with various options for opening and creating documents. The data field must provide a<br />

PropertyValue structure for each option in which the name of the option is saved as a string as well as the<br />

associated value.<br />

loadComponentFromURL supports the following options:<br />

AsTemplate (Boolean)<br />

if true, loads a new, untitled document from the given URL. If is false, template files are loaded for editing.<br />

CharacterSet (String)<br />

defines which set of characters a document is based on.<br />

FilterName (String)<br />

specifies a special filter for the loadComponentFromURL function. The filter names available are defined<br />

in the \share\config\registry\instance\<strong>org</strong>\openoffice\office\TypeDetection.xml file.<br />

FilterData (String)<br />

defines additional options for filters.<br />

FilterOptions (String)<br />

defines additional options (used by old filters).<br />

Hidden (Boolean)<br />

value true loads the document in invisible mode.<br />

JumpMark (String)<br />

once a document has been opened, jumps to the position defined in JumpMark.<br />

MacroExecutionMode (Integer)<br />

indicates if document macros may be executed. Values : see com.sun.star.document.MacroExecMode<br />

Password (String)<br />

transfers a password for a protected file.<br />

ReadOnly (Boolean)<br />

value true loads a document in read-only mode.<br />

UpdateDocMode (Integer)<br />

indicates how/if links will be updated. Values : see com.sun.star.document.UpdateDocMode<br />

The following example shows how a text file separated by a comma in <strong>OpenOffice</strong>.<strong>org</strong> Calc can be opened using<br />

the FilterName option.<br />

Dim Doc As Object<br />

Dim FileProperties(1) As New com.sun.star.beans.PropertyValue<br />

Dim Url As String<br />

Url = "file:///C:/doc.csv"<br />

FileProperties(0).Name = "FilterName"<br />

FileProperties(0).Value ="Text - txt - csv (StarCalc)"<br />

FileProperties(1).Name = "FilterOptions"<br />

FileProperties(1).value = "44,34,0,1"<br />

Doc = StarDesktop.loadComponentFromURL(Url, "_blank", 0, FileProperties())<br />

62 <strong>OpenOffice</strong>.<strong>org</strong> 3.2 <strong>BASIC</strong> <strong>Guide</strong> · March 2010

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

Saved successfully!

Ooh no, something went wrong!