[Solved] Calc Macro to set printer parameters?
Posted: Thu Jul 28, 2011 6:26 pm
Have sub to set up my Epson CX6000 printer bt it does not set landscape mode or reduction value?
Have been all over the net etc with no results.
Hade the " page.IsLandscape = true"statement in before to no avail.
Would appreciate any ideas.
Gary
Have been all over the net etc with no results.
Hade the " page.IsLandscape = true"statement in before to no avail.
Code: Select all
Sub FormatPrinterLandscape
Dim sS as String '$ 'Style name
Dim oStyle as Object 'The current page style
REM Use the currently active sheet to obtain the page style.
REM In a Calc document, the current controller knows which sheet is active.
REM SET SHEET SCALE TO 83%
sS = ThisComponent.CurrentController.getActiveSheet().PageStyle
oStyle = ThisComponent.StyleFamilies.getByName("PageStyles").getByName(sS)
oStyle.PageScale = 83 'Scale document to 83%
pageStyles = thisComponent.StyleFamilies.getByName("PageStyles")
page = pageStyles.getByName("Default")
REM SET PAGE SIZE TO 8.5 X 11.0 IN MILLIMETERS
page.width = 27932 '29700
page.height = 21584 '21000
REM SET MARGINS LEFT = .75" RIGHT, TOP, BOTTOM = .5"
page.LeftMargin = 1905
page.RightMargin = 1270
page.TopMargin = 1270
page.BottomMargin = 1270
REM Set Page Orientation TO LANDSCAPE
'page.IsLandscape = true
Dim printerOption(0) As New com.sun.star.beans.PropertyValue
printerOption(0).Name = "PaperOrientation"
printerOption(0).Value = com.sun.star.view.PaperOrientation.LANDSCAPE
thisComponent.Printer = printerOption()
'MsgBox "Set printer to Landscape"
REM NO Header
page.HeaderIsOn = False
rem Add a Footer
page.FooterIsOn = True
End Sub
Gary