以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  筛选后打印  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=15150)

--  作者:狐友
--  发布时间:2011/12/14 14:03:00
--  筛选后打印

想根据管理员,逐步筛选后用excel报表打印,一个一个的打印,下面的代码打印出来不对

帮忙看下,谢谢!
    Dim tb As Table = Tables("销售订单.销售明细")
    Dim pr As Row = Tables("销售订单").Current
    Dim bh As String  = "订单编号 = \'" & pr("订单编号") & "\'"
    Dim Regions As List(Of String) = tb.DataTable.GetUniqueValues(bh,"管理员")
For Each Region As String In Regions 
   Tables("销售订单.销售明细").Filter = "[管理员] = \'" & Region & "\'"

 

    Dim Book As New XLS.Book(ProjectPath & "Attachments\\book2.xls")
    Dim fl As String = ProjectPath & "Reports\\book2.xls"
    Book.Build() \'生成细节区
    Book.Save(fl) \'保存工作簿
    Dim Proc As New Process \'打开工作簿
    Proc.File = fl
    Proc.Start()

 

Next

Tables("销售订单.销售明细").Filter = ""

[此贴子已经被作者于2011-12-14 14:10:47编辑过]

--  作者:程兴刚
--  发布时间:2011/12/14 14:09:00
--  

应该先告诉错误原因吧?

 


--  作者:狐友
--  发布时间:2011/12/14 14:12:00
--  
就是全部都打印出来了,不是按管理员筛选后打印,我找个列子上来
--  作者:狐狸爸爸
--  发布时间:2011/12/14 14:16:00
--  
Dim tb As Table = Tables("销售订单.销售明细")
Dim pr As Row = Tables("销售订单").Current
Dim bh As String  = "订单编号 = \'" & pr("订单编号") & "\'"
Dim Regions As List(Of String) = tb.DataTable.GetUniqueValues(bh,"管理员")
For Each Region As String In Regions
    Tables("销售订单.销售明细").Filter = "[管理员] = \'" & Region & "\'"
    Dim Book As New XLS.Book(ProjectPath & "Attachments\\book2.xls")
    Dim fl As String = ProjectPath & "Reports\\book2.xls"
    Book.Build() \'生成细节区
    Book.Save(fl) \'保存工作簿
    Dim Proc As New Process \'打开工作簿
    Proc.File = fl
    proc.WaitForClose = True
    Proc.Start()
Next
Tables("销售订单.销售明细").Filter = ""