Dim rb2 As WinForm.RadioButton = e.Form.Controls("RadioButton2")
Dim ck3 As WinForm.CheckBox = e.Form.Controls("checkbox3")
If rb2.Checked=True
Dim doc As New PrintDoc '定义一个报表
Doc.PageSetting.PaperKind=9
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
Doc.PageSetting.leftMargin = 0
Doc.PageSetting.rightMargin = 0
Doc.PageSetting.TopMargin =0
Doc.PageSetting.BottomMargin =0
Dim ck As WinForm.CheckBox =e.Form.Controls("checkbox1")
Dim Rows As List(Of DataRow)
Dim tb As Table=Tables("小学报名_table5")
tb.sort= "考试室,考号"
Dim dr As DataRow = tb.DataTable.Find("考试室 is null")
Dim regions As List(of String())
If dr Is Nothing
Regions = tb.DataTable.GetValues("考试名称|单位名称|考试室","","考试室") ''''改后句子
Else
Regions = tb.DataTable.GetValues("考试名称|单位名称|年级") ''''改后句子
End If
Dim rm As prt.RenderEmpty
For Each region As String() In Regions
rm = new prt.RenderEmpty '定义一个新的空对象
rm.BreakBefore = prt.BreakEnum.Page '打印前换页
doc.Body.Children.Add(rm)
If dr Is Nothing
Rows = tb.DataTable.Select("[单位名称] = '" & region(1) & "'And [考试室] ='" & region(2) & "'and [考试名称] ='" & region(0) & "'","考试室,考号")
Else
Rows = tb.DataTable.Select("[单位名称] = '" & region(1) & "'And [年级] ='" & region(2) & "'and [考试名称] ='" & region(0) & "'","考试室,考号")
End If
For r As Integer = 0 To Rows.Count -1
Dim ra As New prt.RenderArea
Dim rt As prt.RenderText
ra.Width = 70 '宽度53毫米
ra.Height = 29.5 '高度24毫米
ra.Style.Spacing.All = 0
ra.Style.Borders.All = New prt.Linedef(0, Color.Red) '设置边框
ra.SplitHorzBehavior = prt.SplitBehaviorEnum.Never '禁止水平分割
ra.SplitVertBehavior = prt.SplitBehaviorEnum.Never '禁止垂直分割
Doc.Body.ChildRen.Add(ra) '将容器加入到报表中
Dim bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code128
BAR.DisplayCode = False
Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
bar.Code = tb.Rows(r)("考号")
Bar.Text = tb.Rows(r)("考号")
Bar.BarRatio = 3
Bar.BarHeight = 10
Bar.TextAlignment = Barpro.Alignment.BelowCenter
Dim rg As new prt.RenderGraphics
bar.DrawOnCanvas(rg.Graphics,0,0,1)
rg.Style.Spacing.All = 0
rg.Style.TextAlignHorz= prt.AlignHorzEnum.Center
rg.y=10
RG.Width=60
ra.Children.Add(rg) '添加到
Next
Next
Doc.Preview() '预览报表
End If
老师请问
1这个条码我想居中,这样不行呢,
2当记录多一点时生成预览很慢,四五百个记录要等两三分钟,有什么办法提高生成效率呢