-- 作者:wsxdwh
-- 发布时间:2012/12/20 17:27:00
-- [求助]
向lin_hailun(你有数据!)!!!
想生成一个按区、学校分组的参赛队员报表,学习使用分组打印和标签打印后编了一段代码,执行时编号和姓名分开了,每行只显示了一列,后面还出现了重叠现象。我的想法是:先按区、学校分组;然后显示每个队员的姓名和编号,并象标签一样显示。
Dim doc As New PrintDoc Dim rt As New prt.RenderText Dim ra1 As New prt.RenderArea Dim ra2 As New prt.RenderArea Dim ra3 As New prt.RenderArea
\'设置一级分组 ra1.Style.Spacing.Bottom = 2 ra1.DataBinding.DataSource = BindTables("报名表") ra1.DataBinding.Grouping.Expressions.Add("Fields!区.Value")
\'打印一级分组的组名 rt.Text= "[Fields!区.Value]:" rt.Style.FontSize = 14 rt.Style.FontBold = True rt.Style.Spacing.Bottom = 2 ra1.Children.Add(rt) \'设置二级分组 ra2 = New Prt.RenderArea ra2.Style.Spacing.Bottom = 2 ra2.DataBinding.DataSource = ra1.DataBinding.DataSource ra2.DataBinding.Grouping.Expressions.Add("Fields!学校.Value") ra1.Children.Add(ra2) \'打印二级分组的组名 rt = New prt.RenderText rt.Text= "[Fields!学校.Value]:" rt.Style.FontSize = 12 rt.Style.FontBold = True rt.Style.Spacing.Bottom = 2 ra2.Children.Add(rt)
\'设置三级分组 ra3=New Prt.RenderArea ra3.Stacking = prt.StackingRulesEnum.InlineLeftToRight ra3.Width = 30 \'设置标签宽度 ra3.SplitHorzBehavior = prt.SplitBehaviorEnum.Never \'禁止水平分割 ra3.SplitVertBehavior = prt.SplitBehaviorEnum.Never \'禁止垂直分割 ra3.Style.Spacing.Right = 2 \'设置标签之间的所有和上下间隔为2毫米 ra3.Style.Spacing.Bottom = 2 ra3.DataBinding.DataSource = BindTables("报名表") \'Doc.Body.ChildRen.Add(ra) \'将容器加入到报表中 ra2.Children.Add(ra3) \'添加到二级分组中
\'设置标签内容 rt = New prt.RenderText rt.Text = "编号:[Fields!编号.Value]" \'rt.DataBinding.DataSource = ra2.DataBinding.DataSource ra3.Children.Add(rt) rt = New prt.RenderText rt.Text = "姓名:[Fields!姓名.Value]" \'rt.DataBinding.DataSource = ra2.DataBinding.DataSource ra3.Children.Add(rt)
doc.body.Children.Add(ra1) doc.Preview()
[此贴子已经被作者于2012-12-21 9:19:42编辑过]
|