[Calc, Python] Print selected sheets and ranges
Posted: Tue Jun 04, 2013 7:13 pm
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.
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
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"