Foxtable(狐表)用户栏目专家坐堂 → excel报表


  共有2106人关注过本帖树形打印复制链接

主题:excel报表

帅哥哟,离线,有人找我吗?
woshiabc
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:160 积分:1214 威望:0 精华:0 注册:2015/7/1 17:35:00
excel报表  发帖心情 Post By:2016/5/27 9:50:00 [显示全部帖子]

 请问下,下面代码总是筛选全部数据,怎么修改成按照筛选条件筛选呢?
Dim Book As New XLS.Book(ProjectPath & "Attachments\报价表.xls") '打开模板
Dim fl As String = ProjectPath & "Reports\报价表.xls"

Dim Sheet As XLS.Sheet = Book.Sheets(0)
Dim Filter As String
With e.Form.Controls("DateTimePicker1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If       
        Filter = Filter & "报价日期 = '" & .Value & "'"   
        'Filter = Filter & "报价日期 = #" & .Value & "#"   '如果是内部表
 End If
End With
With e.Form.Controls("ComboBox1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "旺旺QQ = '" & .Value & "'"
    End If
End With

If filter > "" Then
    Sheet(1,13).Value = "<" & filter & ">"
Else
    Sheet(1,13).Value = "<all>"
End If
Book.Build() '生成报表
Book.Save(fl)
Dim Proc As New Process
Proc.File = fl
Proc.Start()


 回到顶部