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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The options of the print method<br />

The StarDesktop<br />

The print method expects a PropertyValue data field as a parameter, which reflects the settings of the print<br />

dialog of <strong>OpenOffice</strong>.<strong>org</strong>:<br />

CopyCount (Integer)<br />

specifies the number of copies to be printed.<br />

FileName (String)<br />

prints the document in the specified file.<br />

Collate (Boolean)<br />

advises the printer to collate the pages of the copies.<br />

Sort (Boolean)<br />

sorts the pages when printing out several copies (CopyCount > 1).<br />

Pages (String)<br />

contains the list of the pages to be printed (syntax as specified in print dialog).<br />

Wait (Boolean)<br />

if set to True the print method will return after the job is stored on the waiting list for the printer. Use this<br />

option if you want to close the document after print.<br />

The following example shows how several pages of a document can be printed out using the Pages option:<br />

Dim Doc As Object<br />

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

PrintProperties(0).Name="Pages"<br />

PrintProperties(0).Value="1-3; 7; 9"<br />

PrintProperties(1).Name="Wait"<br />

PrintProperties(1).Value=True<br />

Doc.print(PrintProperties())<br />

Printer selection and settings<br />

The com.sun.star.view.XPrintable interface provides the Printer property, which selects the printer. This<br />

property receives a PropertyValue data field with the following settings:<br />

Name (String)<br />

specifies the name of printer.<br />

PaperOrientation (Enum)<br />

specifies the paper orientation (com.sun.star.view.PaperOrientation.PORTRAIT value for portrait format,<br />

com.sun.star.view.PaperOrientation.LANDSCAPE for landscape format).<br />

PaperFormat (Enum)<br />

specifies the paper format (for example, com.sun.star.view.PaperFormat.A4 for DIN A4 or<br />

com.sun.star.view.PaperFormat.Letter for US letters).<br />

PaperSize (Size)<br />

specifies the paper size in hundredths of a millimeter.<br />

The following example shows how a printer can be changed and the paper size set with the help of the Printer<br />

property.<br />

Dim Doc As Object<br />

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

Dim PaperSize As New com.sun.star.awt.Size<br />

PaperSize.Width = 20000 ' corresponds to 20 cm<br />

PaperSize.Height = 20000 ' corresponds to 20 cm<br />

PrinterProperties (0).Name="Name"<br />

PrinterProperties (0).Value="My HP Laserjet"<br />

PrinterProperties (1).Name="PaperSize"<br />

PrinterProperties (1).Value=PaperSize<br />

Chapter 5 · Working with Documents 65

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

Saved successfully!

Ooh no, something went wrong!