打印标签
有了绑定,打印标签比以前更简单。
示例
Dim
doc
As New PrintDoc '定义一个报表
Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
Dim ra As New prt.RenderArea
Dim rt As prt.RenderText
ra.Width = 40 '设置标签宽度
ra.SplitHorzBehavior = prt.SplitBehaviorEnum.Never
'禁止水平分割
ra.SplitVertBehavior = prt.SplitBehaviorEnum.Never
'禁止垂直分割
ra.Style.Spacing.Right = 2
'设置标签之间的所有和上下间隔为2毫米
ra.Style.Spacing.Bottom = 2
ra.Style.Padding.All = 1 '
标签内容距离边框为1毫米
ra.Style.Borders.All = New prt.Linedef(0.3,
Color.Red) '设置边框
ra.DataBinding.DataSource = BindTables("员工")
'将容器绑定到员工表
Doc.Body.ChildRen.Add(ra) '将容器加入到报表中
rt = New prt.RenderText
rt.Text = "姓名:[Fields!姓名.Value]"
ra.Children.Add(rt) '添加到容器中
rt = New prt.RenderText
rt.Text = "部门:[Fields!部门.Value]"
ra.Children.Add(rt) '添加到容器中
rt = New prt.RenderText
rt.Text = "职务:[Fields!职务.Value]"
ra.Children.Add(rt) '添加到容器中
Doc.Preview() '预览报表
执行结果:
本页地址:http://www.foxtable.com/webhelp/topics/1255.htm