连续套打
如果要连续套打,必须在打印每一个单据后,能够自动换页,准备套打下一个单据。
因为套打中的对象都是直接指定坐标后加入到到表中的,所以我们只能通过插入RenderEmpty来实现换页。
下面的代码,套打选定行的员工资料卡,请在员工表中选定多行进行测试:
Dim
doc
As New PrintDoc
'定义一个报表
Dim rx As
prt.RenderText '定义一个文本对象
Dim rm As
prt.RenderImage '定义一个图形队形
Dim Currow As
Row
Dim tbl As
Table =
Tables("员工")
For i as
Integer = tbl.TopRow
To tbl.BottomRow
CurRow = tbl.rows(i)
Dim rep
As New prt.RenderEmpty
'定义一个新的空对象
rep.BreakBefore = prt.BreakEnum.Page
'打印前换页
doc.Body.Children.Add(rep )
'加入到报表中
rx = new prt.RenderText
rx.Text = CurRow("姓名")
rx.x = 51
rx.y = 36
doc.body.Children.Add(rx)
rx = new prt.RenderText
rx.Text = CurRow("出生日期")
rx.x = 109
rx.y = 36
doc.body.Children.Add(rx)
rx = new prt.RenderText
rx.Text = CurRow("部门")
rx.x = 51
rx.y = 43
doc.body.Children.Add(rx)
rx = new prt.RenderText
rx.Text = CurRow("雇佣日期")
rx.x = 109
rx.y = 43
doc.body.Children.Add(rx)
rx = new prt.RenderText
rx.Text = CurRow("性别")
rx.x = 51
rx.y = 50
doc.body.Children.Add(rx)
rx = new prt.RenderText
rx.Text = CurRow("职务")
rx.x = 109
rx.y = 50
doc.body.Children.Add(rx)
rx = new prt.RenderText
rx.Text = CurRow("城市")
rx.x = 51
rx.y = 57
doc.body.Children.Add(rx)
rx = new prt.RenderText
rx.Text = CurRow("邮政编码")
rx.x = 109
rx.y = 57
doc.body.Children.Add(rx)
rx = new prt.RenderText
rx.Text = CurRow("地址")
rx.x = 51
rx.y = 63
doc.body.Children.Add(rx)
rx = new prt.RenderText
rx.Text = CurRow("家庭电话")
rx.x = 51
rx.y = 69.5
doc.body.Children.Add(rx)
rx = new prt.RenderText
rx.Text = CurRow("办公电话")
rx.x = 109
rx.y = 69.5
doc.body.Children.Add(rx)
rx = new prt.RenderText
rx.Text = CurRow("备注")
rx.x = 26.5
rx.y = 76
rx.Width= 163
doc.body.Children.Add(rx)
rm= New prt.RenderImage
rm.Height = 38
rm.Width = 34
rm.Image = GetImage(CurRow("照片"))
rm.x= 149.5
rm.y = 36
doc.body.Children.Add(rm)
Next
Doc.Preview() '预览报表
本页地址:http://www.foxtable.com/webhelp/topics/1247.htm