这条代码如何修改 请专家指教!
另外:不同的竞赛项目,"2013年武汉市中小学航空航天模型竞赛"名称也要改。例如:
航海模型竞赛就要改为:"2013年武汉市中小学航海模型竞赛"。
做了个文本框引用用,没能实现。请专家指教
Dim doc As New PrintDoc
Dim r As New prt.RenderText
Dim rt As New prt.RenderText
Dim ra1 As New prt.RenderArea
Dim ra2 As New prt.RenderArea
Dim ra3 As New prt.RenderArea
Dim ra4 As New prt.RenderArea
'设置表名
r = New prt.RenderText
r.Text= "2013年武汉市中小学航空航天模型竞赛"
r.Style.FontSize = 14
r.Style.FontBold = True
r.Style.TextAlignHorz = prt.AlignHorzEnum.Center
r.Style.Spacing.Bottom = 5
doc.Body.Children.Add(r)
r = New prt.RenderText
r.Text= "竞赛分组表"
r.Style.FontSize = 14
r.Style.FontBold = True
r.Style.TextAlignHorz = prt.AlignHorzEnum.Center
r.Style.Spacing.Bottom = 5
doc.Body.Children.Add(r)
'设置一级分组
ra1.Style.Spacing.Bottom = 2
ra1.DataBinding.DataSource = BindTables("报名表")
ra1.DataBinding.Grouping.Expressions.Add("Fields!参赛项目.Value")
'打印一级分组的组名
rt.Text= "[Fields!参赛项目.Value]:"
rt.Style.FontSize = 12
rt.Style.FontBold = True
rt.Style.Spacing.Bottom = 2
ra1.Children.Add(rt)
'设置二级分组
ra2 = New Prt.RenderArea
ra2.Style.Spacing.Bottom = 2
ra2.Stacking = prt.StackingRulesEnum.InlineLeftToRight
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 = 10
rt.Style.FontBold = True
rt.Style.Spacing.Bottom = 2
ra2.Children.Add(rt)
'设置三级分组
ra3 = New Prt.RenderArea
ra3.Style.Spacing.Bottom = 2
ra3.Stacking = prt.StackingRulesEnum.InlineLeftToRight
ra3.DataBinding.DataSource = ra1.DataBinding.DataSource
ra3.DataBinding.Grouping.Expressions.Add("Fields!场地.Value")
ra2.Children.Add(ra3)
'打印三级分组的组名
ra4 = New prt.RenderArea
ra4.Stacking = prt.StackingRulesEnum.InlineLeftToRight
rt = New prt.RenderText
rt.Text= "[Fields!场地.Value]:"
rt.Style.FontSize = 10
rt.Style.FontBold = True
rt.Style.Spacing.Bottom = 2
ra3.Children.Add(rt)
'设置标签内容
ra4 = New prt.RenderArea
ra4.Width = 33
ra4.Stacking = prt.StackingRulesEnum.InlineLeftToRight
rt = New prt.RenderText
rt.Text = "[Fields!编号.Value]"
rt.Width = 15
ra4.Children.Add(rt)
rt = New prt.RenderText
rt.Text = "[Fields!姓名.Value]"
rt.Width = 18
ra4.DataBinding.DataSource = ra3.DataBinding.DataSource
ra4.Children.Add(rt)
ra3.Children.Add(ra4)
ra2.Children.Add(ra3)
doc.body.Children.Add(ra1)
Doc.PageSetting.LeftMargin = 25 '设置左边距
Doc.PageSetting.RightMargin = 15 '设置右边距
Doc.PageSetting.TopMargin = 20 '设置上边距
Doc.PageSetting.BottomMargin = 20 '设置下边距
doc.Preview()