Foxtable(狐表)用户栏目专家坐堂 → [分享]数据查询,自定义导出列


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

主题:[分享]数据查询,自定义导出列

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/10/17 12:16:00 [显示全部帖子]

谢谢分享

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/12/8 17:15:00 [显示全部帖子]

 

项目事件

 

AfterOpenProject

 

MainTable = Tables("表A")

Forms("窗口1").Open()

 

计划管理

 

表事件

 

表A_AfterLoadTableSetting

 

Tables("表A").SetHeaderRowHeight(30,30)

'行高设置

Dim t As Table = Tables("表A")

t.DefaultRowHeight  = 30 '所有行高

 

窗口表事件

 

窗口与控件事件

 

窗口1_AfterLoad

 

'网格线颜色

Tables("表A").Grid.Styles("Normal").Border.Color = Color.SteelBlue

 

窗口1_Button1_Click

 

Dim Filter As String

With e.Form.Controls("所属机构")

    If .Value IsNot Nothing Then

        Filter = "第一列 = '" & .Value & "'"

    End If

End With

With e.Form.Controls("起始日期")

    If .Value IsNot Nothing Then

        If Filter >"" Then

            Filter = Filter & " And "

        End If

        Filter = Filter & "第三列 >= #" & .Value & "#"

    End If

End With

With e.Form.Controls("截止日期")

    If .Value IsNot Nothing Then

        If Filter >"" Then

            Filter = Filter & " And "

        End If

        Filter = Filter & "第四列 <= #" & .Value & "#"

    End If

End With

If Filter > "" Then

    Tables("表A").Filter = Filter

End If

 

窗口1_Button2_Click

 

Dim dlg As New SaveFileDialog '定义一个新的SaveFileDialog

dlg.Filter= "Excel文件|*.xls" '设置筛选器

If dlg.ShowDialog = DialogResult.Ok Then

    Dim ccb As WinForm.CheckedComboBox = e.Form.Controls("CheckedComboBox1")

    Dim ws As String =  Tables("表A").getColVisibleWidth

    If ccb.Text > "" Then

        Dim lst As new List(of String)

        lst.AddRange(ccb.Text.Split(","))

        For Each c As Col In Tables("表A").Cols

            c.Visible = lst.Contains(c.Name)

        Next

    End If

    Dim flg As New  SaveExcelFlags

    flg.RowNumber = True

    flg.CellStyle = True

    flg.VisibleOnly = True

    Tables("表A").SaveExcel(dlg.FileName,"表A",flg)

    Tables("表A").SetColVisibleWidth(ws)

    Dim Proc As New Process

    Proc.File = dlg.FileName

    Proc.Start()

End If

 

窗口1_Button3_Click

 

Dim sbxh As WinForm.ComboBox = e.Form.Controls("所属机构")

Dim StartDate As WinForm.DateTimePicker = e.Form.Controls("起始日期")

Dim EndDate As WinForm.DateTimePicker = e.Form.Controls("截止日期")

 

sbxh.Text = ""

StartDate.Value =""

EndDate.Value =""

 

Tables("表A").ApplyFilter = False

'Tables("中标统计").Sort = "项目编码"

 

窗口1_CheckedComboBox1_Enter

 

e.sender.Items.Clear

For Each c As Col In Tables("表A").Cols

    e.sender.Items.add(c.name)

Next

 

窗口1_所属机构_Enter

 

e.Sender.ComboList=DataTables("表A").GetComboListString("第一列")

 

自定义函数

 

全局代码

 

菜单事件

 

 


 回到顶部