-- 作者:wsxdwh
-- 发布时间:2013/1/29 16:39:00
--
窗口中有一控件“竞赛名称”,可选文本为“2013航海模型”;“2013航空航天模型”等,
现在想将其中的前4 个字符“2013”连接现有字符“年武汉市中小学”再连接其中的剩下的字符“航海模型”及现有字符“竞赛”结果为
“2013年武汉市中小学航海模型竞赛”
如何编写代码 请指教!!!
在命令窗口试了一下
Dim a As WinForm.ComboBox = Forms("报名表_编排").Controls("竞赛名称") Dim Str As String ="" & a.text & "" Dim Str1 As String=str.SubString(0,3) Output.Show(Str1)
提示错误(上传图片)
应用于一下代码中 将r。text的文本变为动态的
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 jsmc As WinForm.ComboBox = e.Form.Controls("竞赛名称")
\'设置表名
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)
\'打印二级分组的组名
ra3 = New prt.RenderArea
ra3.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)
ra2.Children.Add(ra3)
\'设置标签内容
ra3 = New prt.RenderArea
ra3.Width = 33
ra3.Stacking = prt.StackingRulesEnum.InlineLeftToRight
rt = New prt.RenderText
rt.Text = "[Fields!编号.Value]"
rt.Width = 15
\'rt.Style.FontSize = 9
ra3.Children.Add(rt)
rt = New prt.RenderText
rt.Text = "[Fields!姓名.Value]"
rt.Width = 18
\'rt.Style.FontSize = 9
ra3.DataBinding.DataSource = ra2.DataBinding.DataSource
ra3.Children.Add(rt)
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()
\'预览报表
|