以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [分享]数据查询,自定义导出列 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=108144) |
||||
-- 作者:cd_tdh -- 发布时间:2017/10/17 11:39:00 -- [分享]数据查询,自定义导出列 首先谢谢有点蓝老师和有点甜老师的帮助,示例文件实现了查找符合条件的机构,时间段,可自行选择需要导出的列,对新手有用,特做示例文件分享供新手学习一下。
[此贴子已经被作者于2017/10/17 11:39:04编辑过]
|
||||
-- 作者:有点甜 -- 发布时间:2017/10/17 12:16:00 -- 谢谢分享 |
||||
-- 作者:hrw68529 -- 发布时间:2017/12/8 17:12:00 -- [讨论]能否把代码发一下,我的版本太低了,打不开软件? 示例文件实现了查找符合条件的机构,时间段,可自行选择需要导出的列,对新手有用,特做示例文件分享供新手学习一下。 请能否把代码发给我学习下一下,谢谢
|
||||
-- 作者:有点甜 -- 发布时间: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("第一列")
自定义函数
全局代码
菜单事件
|