Dim Doc As new PrintDoc '定义专业报表
Dim title As New prt.RenderTable() '定义一个表格对象
Dim pt As New prt.RenderTable() '定义一个表格对象
doc.PageSetting.Width = 240 '纸张宽度为100毫米
doc.PageSetting.Height = 140 '纸张高度为120毫米
doc.PageSetting.Landscape = True '横向打印
Dim tx As prt.RenderText = new prt.RenderText '标题
Dim kh As prt.RenderText = new prt.RenderText '客户名称
Dim pp As prt.RenderText = new prt.RenderText '品牌名称
Dim Lists As prt.RenderText = new prt.RenderText '订单编号
Dim dt As prt.RenderText = new prt.RenderText '日期
Dim pg As prt.RenderText = new prt.RenderText '页码
Dim dts As Date
kh.Text = "客户名称:"
pp.Text = "品牌名称:尚品本色木门"
Lists.Text = "订单编号:"
dt.Text = "日期:" & Format(dts.Date,"yyyy-MM-dd") ' 如何调用当前日期?
pg.text = "1/1"
tx.Text = "鑫迪家居有限公司销售单"
tx.Style.Font = new Font("黑体",18,FontStyle.Bold)
tx.Style.TextAlignHorz = prt.AlignHorzEnum.Center
doc.Body.Children.Add(title) '将表格对象加入到报表中
doc.Body.Children.Add(pt) '将表格对象加入到报表中
pt.Width = 110 ' 表头宽度为110毫米,
'pt.Height = 36 ' 表头高度为140毫米,
title.Width = 240 ' 表头宽度为240毫米,和piao据的尺寸一致
'title.Height = 18 ' 表头高度为140毫米,
title.Style.GridLines.All = New prt.LineDef '设置网格线类型
pt.Style.GridLines.All = New prt.LineDef '设置网格线类型
pt.Rows.Count = 2 ' 行数
pt.Cols.Count = 3 '列数
title.Rows.Count = 1 ' 行数
title.Cols.Count = 1 '列数
title.Cells(0,0).RenderObject = tx
pt.Cells(0,0).RenderObject = kh
pt.Cells(0,1).RenderObject = pp
pt.Cells(1,0).RenderObject = Lists
pt.Cells(1,1).RenderObject = dt
pt.Cells(1,2).RenderObject = pg
Doc.Preview()
以上是代码,有两个问题,一个是日期问题,另外一个是我的单据是宽度240毫米,高度是140毫米的,应该怎么设置呢?我设置的时候,按照横向打印的时候老是出现竖向打印。。。

此主题相关图片如下:2012-05-12-1.jpg