以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  导出word报表,如何显示进度条  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=175054)

--  作者:bzqlyj
--  发布时间:2022/2/17 20:14:00
--  导出word报表,如何显示进度条
导出word报表,如何显示进度条,并同时显示总多少份,已导出多少份,剩余多少份
--  作者:有点蓝
--  发布时间:2022/2/17 20:33:00
--  
使用代码导出,就可以做进度:http://www.foxtable.com/webhelp/topics/2890.htm

比如:
Dim p As WinForm.ProgressBar
p = e.Form.Controls(
"ProgressBar1")

p.Minimum = 
\'设置最小值
p.Value = 
\'设置当前值
Dim drs As List(of DataRow) = DataTables("出库").Select("出库日期 = #" & Date.Today & "#"\'筛选出符合条件的行
If 
drs.Count > 0 Then \'如果存在符合条件的行
p.Maximum = drs.Count \'设置最大值
  For i as integer = 0 to drs.count - 1 \'逐行生成报表
dim dr as datarow = drs(i)
    Dim 
tm As String  = ProjectPath & "Attachments\\出库单.doc" \'指定模板文件
    Dim 
fl As String = ProjectPath & "Reports\\出库单" & dr("出库单编号") & ".doc" \'指定目标文件
    Dim wrt As New WordReport(Tables("出库"),tm,fl\'定义一个WordReport
        
wrt.BuildOne(dr)
wrt.Quit
p.Value = i \'当前值为已经完成的行数
Application.DoEvents()
    Next
End If

--  作者:bzqlyj
--  发布时间:2022/2/18 9:40:00
--  
不知错在那里,还是不能显示

For Each r As Row In Tables("jbxx").Rows

        Dim p As WinForm.ProgressBar

        p = e.Form.Controls("ProgressBar1")

        p.Minimum = 0 \'设置最小值

        p.Value = 0 \'设置当前值

        Dim drs As List(of DataRow) = DataTables("jbxx").Select(" zz=\'" & r("zz") & "\'and  bh =\'" & r("bh") & "\'and  sj =\'" & r("sj") & "\'")\'\'筛选出符合条件的行

        If drs.Count > 0 Then \'如果存在符合条件的行

            p.Maximum = drs.Count \'设置最大值

            For i As Integer = 0 To drs.count - 1 \'逐行生成报表

                Dim dr As DataRow = drs(i)

                \'For Each dr As DataRow In drs \'逐行生成报表

                Dim tm As String  = ProjectPath & "Attachments\\ A3模板定.doc" \'指定模板文件

                Dim fl As String = ProjectPath & "导出\\" & dr("zz") & dr("bh") & dr("xm") & dr("sj") & ".doc" \'指定目标文件

                Dim wrt As New WordReport(Tables("jbxx"),tm,fl) \'定义一个WordReport

                wrt.BuildOne(dr)

                

                wrt.Quit

                If i Mod 10 = 0 Then

                    p.Value = i \'当前值为已经完成的行数

                End If

                Application.DOEVents()

               

                

            Next

        End If

        

    Next


--  作者:有点蓝
--  发布时间:2022/2/18 9:49:00
--  
去掉If i Mod 10 = 0 Then

--  作者:bzqlyj
--  发布时间:2022/2/18 9:58:00
--  回复:(有点蓝)去掉If i Mod 10 = 0 Then
去掉了已不显示
--  作者:有点蓝
--  发布时间:2022/2/18 10:13:00
--  
请上传实例说明
--  作者:bzqlyj
--  发布时间:2022/2/18 11:00:00
--  回复:(有点蓝)请上传实例说明
已上传
--  作者:有点蓝
--  发布时间:2022/2/18 11:08:00
--  
http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&Id=78
--  作者:bzqlyj
--  发布时间:2022/2/18 11:27:00
--  回复:(有点蓝)使用代码导出,就可以做进度:http:/...
已上传例子