OpenOffice.org BASIC Guide - OpenOffice.org wiki
OpenOffice.org BASIC Guide - OpenOffice.org wiki
OpenOffice.org BASIC Guide - OpenOffice.org wiki
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
The StarDesktop<br />
End If<br />
End If<br />
The example first checks whether the relevant document has been modified since it was last saved. It only<br />
continues with the saving process if this is the case. If the document has already been assigned a URL and is not a<br />
read-only document, it is saved under the existing URL. If it does not have a URL or was opened in its read-only<br />
status, it is saved under a new URL.<br />
storeAsURL Method Options<br />
As with the loadComponentFromURL method, some options can also be specified in the form of a<br />
PropertyValue data field using the storeAsURL method. These determine the procedure <strong>OpenOffice</strong>.<strong>org</strong> uses<br />
when saving a document. storeAsURL provides the following options:<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 />
Overwrite (Boolean)<br />
allows a file which already exists to be overwritten without a query.<br />
Password (String)<br />
transfers the password for a protected file.<br />
Unpacked (Boolean)<br />
saves the document (not compressed) in sub-directories.<br />
The possibility to store documents in unpacked way is not currently supported, the "Unpacked" property is<br />
just ignored, see Issue 64364 .<br />
The following example shows how the Overwrite option can be used in conjunction with storeAsURL:<br />
Dim Doc As Object<br />
Dim FileProperties(0) As New com.sun.star.beans.PropertyValue<br />
Dim Url As String<br />
' ... Initialize Doc<br />
Url = "file:///c:/test3.odt"<br />
FileProperties(0).Name = "Overwrite"<br />
FileProperties(0).Value = True<br />
Doc.storeAsURL(Url, FileProperties())<br />
The example then saves Doc under the specified file name if a file already exists under the name.<br />
Printing Documents<br />
Similar to saving, documents are printed out directly by means of the document object. The Print method of the<br />
com.sun.star.view.Xprintable interface is provided for this purpose. In its simplest form, the print call is:<br />
Dim Dummy()<br />
Doc.print(Dummy())<br />
As in the case of the loadComponentFromURL method, the Dummy parameter is a PropertyValue data field<br />
through which <strong>OpenOffice</strong>.<strong>org</strong> can specify several options for printing.<br />
64 <strong>OpenOffice</strong>.<strong>org</strong> 3.2 <strong>BASIC</strong> <strong>Guide</strong> · March 2010