Foxtable(狐表)用户栏目专家坐堂 → EXCEL报表求助


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

主题:EXCEL报表求助

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


加好友 发短信
等级:狐神 帖子:6708 积分:34304 威望:0 精华:11 注册:2012/8/18 23:10:00
  发帖心情 Post By:2013/1/22 16:29:00 [显示全部帖子]

 楼主,你的代码就差一步了。测试有效。

If e.Form.Controls("DateTimePicker1").VALUE Is Nothing = False Then
    Dim Filter As String = "<[日期] = #" & e.Form.Controls("DateTimePicker1").VALUE  & "#"
    Dim ra1 As WinForm.RadioButton = e.Form.Controls("RadioButton1")
    Dim ra2 As WinForm.RadioButton = e.Form.Controls("RadioButton2")
    Dim cb As WinForm.CheckedComboBox = e.Form.Controls("CheckedComboBox1")
    Dim Filter1 As String
    If ra2.Checked = True Then
        If cb.Value>"" Then
            Dim nms() As String = cb.Value.Split(",")
            For i As Integer = 0 To nms.Length - 1
                filter1 &= " [客户] = '" & nms(i) & "' or "
            Next
            filter1 &= "1=2"
            filter &= " And (" & filter1 & ")"
        Else
            MessageBox.show("兄弟,你还没选择要复制订单的客户!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
            cb.Select()
            Return
        End If
    End If
   
    Dim Book As New XLS.Book(ProjectPath & "Attachments\送货单.xls") '打开模板
    Dim fl As String = ProjectPath & "Reports\送货单.xls"
    Dim Sheet As XLS.Sheet = Book.Sheets(0)
    filter &=  ">"
    msgbox(filter)
    Sheet(1,12).Value = filter
   
    Book.Build() '生成报表
    Book.Save(fl)
    Dim Proc As New Process
    Proc.File = fl
    Proc.Start()
Else
    MessageBox.Show("你忘记选择要复制的订单日期了哦!","^O^^O^温馨提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    e.Form.Controls("DateTimePicker1").Select()
    Return
End If
e.Form.Close
[此贴子已经被作者于2013-1-22 16:29:12编辑过]

 回到顶部