以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]代码优化  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=112888)

--  作者:l1q2lq
--  发布时间:2018/1/4 17:30:00
--  [求助]代码优化
Dim t As Table = e.Form.Controls("Table1").Table
For Each r1 As Row In t.GetCheckedRows()
    r1("已打印") = True
    Dim Bar As New BarCodeBuilder
    Bar.Symbology = Barpro.Symbology.QRCode
    Bar.Code = r1("箱号")
    Bar.BarRatio = 0.3
    Bar.BarHeight = 8
    bar.SaveImage(ProjectPath & "Images\\myimg.wmf",300)
    Dim tm As String  = ProjectPath & "Attachments\\物料标签.doc" \'指定模板文件
    Dim fl1 As String = ProjectPath & "Reports\\物料标签\\" & r1("箱号") & "物料标签.doc"    
    Dim wrt As New WordReport(Tables("标签创建"),tm,fl1)
    wrt.Build() \'逐行生成报表    
    wrt.Quit() \'退出    
Next

老师帮忙看下,这个导出报表的速度比较慢,有什么办法可以优化的?

--  作者:有点甜
--  发布时间:2018/1/4 17:34:00
--  

代码无法优化了,word报表本来就是比较慢的。你打印多少行数据?用多少秒?

 

Dim t As Table = e.Form.Controls("Table1").Table
For Each r1 As Row In t.GetCheckedRows()
    r1("已打印") = True
    Dim Bar As New BarCodeBuilder
    Bar.Symbology = Barpro.Symbology.QRCode
    Bar.Code = r1("箱号")
    Bar.BarRatio = 0.3
    Bar.BarHeight = 8
    bar.SaveImage(ProjectPath & "Images\\myimg.wmf",300)
    Dim tm As String  = ProjectPath & "Attachments\\物料标签.doc" \'指定模板文件
    Dim fl1 As String = ProjectPath & "Reports\\物料标签\\" & r1("箱号") & "物料标签.doc"   
    Dim wrt As New WordReport(Tables("标签创建"),tm,fl1)
    wrt.BuildOne(r1) \'逐行生成报表   
    wrt.Quit() \'退出   
Next