Page 1 of 1

[Calc, Python] Print selected sheets and ranges

PostPosted: Tue Jun 04, 2013 7:13 pm
by Villeroy
2016-06-27: Credits to Andrew Davison, the author of “Java LibreOffice Programming” (JLOP) who pointed me to a viable solution which is able to print selected sheets. This is not a solution for selected ranges yet. See attached spreadsheet document.
The Basic code specifies selected sheets by an array of indices, a boolean constant if the output should be printed to file or printer device together with a file name and a printer name for the respective output.
Code: Select all   Expand viewCollapse view
REM we are going to print the first and third sheet:
aSheetNums = Array(0, 2)

REM Print to file
Const bPrintToFile = True
sOutFile = ThisComponent.URL & ".pdf"

REM if not to file, specify printer name
Const cPrinterName = "PDF"

Re: [Calc, Python] Print selected sheets and ranges

PostPosted: Sun Feb 08, 2015 5:50 am
by RichieRH
Nice.........Tks

Re: [Calc, Python] Print selected sheets and ranges

PostPosted: Thu Feb 12, 2015 12:44 pm
by RichieRH
How do I used it?Any examples would be appreciate ...