以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 汇总表字段列顺序问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=153705) |
-- 作者:刘林 -- 发布时间:2020/8/20 9:01:00 -- 汇总表字段列顺序问题 Dim tb4 As Table= Tables("排课_table4") Dim g As New GroupTableBuilder("统计表1", DataTables("课程安排")) g.Groups.AddDef("单位全称") g.Groups.AddDef("学期") g.Groups.AddDef("年级") g.Groups.AddDef("班级") tb4.DataSource = g.Build() For Each v As String In DataTables("课程安排").GetValues("科目") tb4.DataTable.DataCols.Add(v,Gettype(String)) Next For Each r As Row In tb4.Rows For Each v As String In DataTables("课程安排").GetValues("科目") Dim dr As DataRow = DataTables("课程安排").find("学期=\'" & r("学期") & "\' And 单位全称= \'" & r("单位全称") & "\' and 班级=\'" & r("班级") & "\' And 科目 = \'" & v & "\'") If dr IsNot Nothing r(v)=dr("教师姓名") & "/" & dr("节数") End If Next Next Tables("排课_table4").DataTable.GlobalHandler.DrawCell = True tb4.AutoSizeCols tb4.AllowEdit=False tb4.Cols.Frozen = 4 请问老师,由课程安排生成汇总表,科目的顺序是按音序出来,但由于操作习惯,一般都是语文、数学、英语、政治、历史、等为顺序,由于科目名称和个数不能确定,设置显示列也不能解决,请问老师,有什么办法来实现解决上面问题
|
-- 作者:有点蓝 -- 发布时间:2020/8/20 9:15:00 -- Dim tb4 As Table= Tables("排课_table4") Dim g As New GroupTableBuilder("统计表1", DataTables("课程安排")) g.Groups.AddDef("单位全称") g.Groups.AddDef("学期") g.Groups.AddDef("年级") g.Groups.AddDef("班级") tb4.DataSource = g.Build() Dim Products As List(Of String) = DataTables("课程安排").GetValues("科目") Dim lst As new List(of String) lst.AddRange({"语文","数学","英语"}) For i As Integer = lst.Count - 1 To 0 Step -1 If Products.Contains(lst(i)) = False Then lst.RemoveAt(i) Next For Each v As String In lst tb4.DataTable.DataCols.Add(v,Gettype(String)) Next For Each r As Row In tb4.Rows For Each v As String In DataTables("课程安排").GetValues("科目") …… |