以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 条码生成效率 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=169100) |
-- 作者:刘林 -- 发布时间:2021/6/2 18:02:00 -- 条码生成效率 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当记录多一点时生成预览很慢,四五百个记录要等两三分钟,有什么办法提高生成效率呢 |
-- 作者:有点蓝 -- 发布时间:2021/6/3 8:46:00 -- 1、rg.Style.TextAlignHorz= prt.AlignHorzEnum.Center 改为 rg.left = 5 2、分批打印,比如一次打印20个记录。
|
-- 作者:刘林 -- 发布时间:2021/6/3 13:03:00 -- 1、分批打印这个办法针对这个问题不好整,因为本身就是做的批量一次性打印,减少重复工作,而且涉及到一个考试室的打完要分页,老师有什么招能提高生成预览的效率。 2、如何让上面的代码如何修改条码宽高并不影响扫码
|
-- 作者:有点蓝 -- 发布时间:2021/6/3 13:46:00 -- 1、批量一样可以分批,写个循环,每次处理20条记录。这样每次生成20条记录的打印信息就可以发送到打印机,而不用全部生成在发送给打印机 2、到这里设置:http://www.foxtable.com/webhelp/topics/2092.htm,然后扫描看效果,合适了再把代码搬到打印中
|