感谢回复,我添加了doc.AutoRotate = False也还是纵向打印。下面贴出我的代码,麻烦帮我查看一下。
以下内容为程序代码:
1 Dim doc As New PrintDoc() '定义一个报表
2 doc.PageSetting.Landscape = True '横向打印
3 doc.AutoRotate = False '禁止自动旋转打印内容
4 doc.PageSetting.Width = 230 '纸张宽度为230毫米
5 doc.PageSetting.Height = 127 '纸张高度为127毫米
6 Doc.PageSetting.LeftMargin = 0 '设置左边距
7 Doc.PageSetting.RightMargin = 0 '设置右边距
8 Doc.PageSetting.TopMargin = 0 '设置上边距
9 Doc.PageSetting.BottomMargin = 0 '设置下边距
10 Dim ra As New prt.RenderArea
11 ra.Width = 85 '宽度为90毫米
12 ra.Height = 15 '高度为15毫米
13 ra.x = 115
14 ra.y = 50
15
16 Dim rx As prt.RenderText '定义一个文本对象
17 Dim CurRow As Row = Tables("客户信息").Current
18
19 rx = new prt.RenderText
20 rx.Style.FontSize = 12 '字体大小
21 rx.Text = "我的姓名"
22 rx.x = 33
23 rx.y = 30
24 doc.body.Children.Add(rx)
25
26 rx = new prt.RenderText
27 rx.Style.FontSize = 12 '字体大小
28 rx.Text = "济南"
29 rx.x = 75
30 rx.y = 30
31 doc.body.Children.Add(rx)
32
33 rx = new prt.RenderText
34 rx.Text = "发货单位"
35 rx.x = 40
36 rx.y = 37
37 doc.body.Children.Add(rx)
38
39 rx = new prt.RenderText
40 rx.Text = "我的单位地址"
41 rx.x = 40
42 rx.y = 55
43 doc.body.Children.Add(rx)
44
45 rx = new prt.RenderText
46 rx.Style.FontSize = 12 '字体大小
47 rx.Text = "我的电话号码"
48 rx.x = 41
49 rx.y = 63
50 doc.body.Children.Add(rx)
51
52 rx = new prt.RenderText
53 rx.Text = "我的签名"
54 rx.x = 43
55 rx.y = 100
56 doc.body.Children.Add(rx)
57
58 rx = new prt.RenderText
59 rx.Text = CurRow("发货日期")
60 rx.x = 23
61 rx.y = 109
62 doc.body.Children.Add(rx)
63
64 rx = new prt.RenderText
65 rx.Style.FontSize = 12 '字体大小
66 rx.Text = CurRow("姓名")
67 rx.x = 127
68 rx.y = 34
69 doc.body.Children.Add(rx)
70
71 rx = new prt.RenderText
72 rx.Text = CurRow("地址")
73 rx.Style.TextAlignVert = prt.AlignVertEnum.Bottom
74 ra.Children.Add(rx) '将文本对象加入到容器ra中
75
76 rx = new prt.RenderText
77 rx.Style.FontSize = 12 '字体大小
78 rx.Text = CurRow("手机")
79 rx.x = 140
80 rx.y = 64
81 doc.body.Children.Add(rx)
82
83 rx = new prt.RenderText
84 rx.Style.FontSize = 12 '字体大小
85 rx.Text = CurRow("电话")
86 rx.x = 180
87 rx.y = 64
88 doc.body.Children.Add(rx)
89
90 doc.Body.Children.Add(ra) '将容器ra加入到报表
91 Doc.PrinterName = "Oki 5330SC"
92 Doc.Preview() '预览报表