IF messageBox("提示","是否打印?",Exclamation!, OKCancel!,1) = 1 Then
openwithparm(w_print_setup,dw_1)
Else
messageBox("提示","打印取消!!")
End IF
dw_1.object.datawindow.print.preview = "yes" //打印预览
dw_1.object.datawindow.print.preview.zoom = 25 //打印预览时的百分比大小
dw_1.object.datawindow.print.margin.top = 100 //上页边距1厘米
dw_1.object.datawindow.print.margin.bottom = 100 //下页边距1厘米
dw_1.object.datawindow.print.margin.left = 100 //左页边距1厘米
dw_1.object.datawindow.print.margin.right = 100 //右页边距1厘米
dw_1.object.datawindow.print.preview.rulers = "yes" //预览时有标尺
dw_1.object.datawindow.print.orientation = 1 //打印时横向
dw_1.object.datawindow.print.orientation = 2 //打印时纵向
dw_1.object.datawindow.print.paper.size = 9 //设置纸张大小为"A4"
dw_1.object.datawindow.print.paper.size = 8 //A3
dw_1.object.datawindow.print.paper.size = 12 //B4
dw_1.object.datawindow.print.paper.size = 13 //设置纸张大小为"B5"[A3是8]
dw_1.object.datawindow.print.color = 1 //单色
dw_1.object.datawindow.print.color = 2 //彩色
dw_1.object.datawindow.print.page.rangeinclude = 0 //打印所有页
dw_1.object.datawindow.print.page.rangeinclude = 1 //打印偶数页
dw_1.object.datawindow.print.page.rangeinclude = 2 //打印奇数页
dw_1.object.datawindow.print.filename = "fileName"//打印到文件
dw_1.describe('datawindow.printer') //当前打印机
dw_report.Object.DataWindow.Print.Orientation = 0 //default 打印机默认dw_report.
Object.DataWindow.Print.Orientation = 1 //landscape 横向dw_report.Object.DataWindow.
Print.Orientation = 2 //Portrait 纵向
补充一个:Page.Range="1,2, 5-10",嵌套了一个report,总是多打印一页
————————————————
原文链接:https://blog.csdn.net/liu8922935/article/details/53201093