Seite 1 von 1

Re: eine bestimmte Zelle drucken

Verfasst: Do 4. Jul 2019, 10:12
von craig
Hallo,

siehe auch die Kommentare im Code:

Code: Alles auswählen

REM Quelle: http://www.oooforum.de/viewtopic.php?t=33793#p130992
Sub Main

Dim oDoc as Object, oSheet as Object
Dim oDrBereich as Object, oDrB as Object, s as String
Dim oDruckbereiche(0)

Dim arg(0) as new com.sun.star.beans.PropertyValue
Dim PrinterProperties(1) as new com.sun.star.beans.PropertyValue
	oDoc = ThisComponent
		oSheet = oDoc.sheets(0)
	' Druckbereich festlegen
	oDrBereich = oSheet.getCellRangeByName("A1").rangeAddress
	oDruckbereiche(0) = oDrBereich

	oSheet.setPrintAreas(oDruckbereiche())
	PrinterProperties(0).name="PaperOrientation"
	' Hochformat = com.sun.star.view.PaperOrientation.PORTRAIT
	' Querformat =com.sun.star.view.PaperOrientation.Landscape
	PrinterProperties(0).value=com.sun.star.view.PaperOrientation.PORTRAIT
	PrinterProperties(1).name="PaperFormat"
	PrinterProperties(1).value=com.sun.star.view.PaperFormat.A4
	arg(0).name="Wait"
	arg(0).value=True
		oDoc.Printer = PrinterProperties()
			ThisComponent.print(arg())

End Sub