Printing a document

From Apache OpenOffice Wiki
Jump to: navigation, search

To print the current document without passing any arguments:


A more generic print routine:

sub subPrint(oDoc, optional ncopies, optional bCollate, optional sPages, optional sFileName)
dim mPrintOptions()
if not isMissing(nCopies) then
        subAddproperty(mPrintOptions(), "CopyCount", nCopies)
end if
if not isMissing(bCollate) then
        subAddproperty(mPrintOptions(), "Collate", bCollate)
end if
if not isMissing(sPages) then
        subAddproperty(mPrintOptions(), "Pages", sPages)
end if
if not isMissing(sFilename) then
        subAddproperty(mPrintOptions(), "FileName", sFileName)
end if
end sub

This function calls subAddProperty which is defined in working with properties.

Example of calling this function:

subprint(ThisComponent, 1, ,"1", "PrintExample.txt")
Personal tools