以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]表关样式  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=143127)

--  作者:cqlpjks
--  发布时间:2019/11/14 10:40:00
--  [求助]表关样式
Dim km1s() As String =  {"语文","数学","英语"}
    For Each bb As String In DataTables("目标设置").GetValues("部别", "[年级]= \'" & tjnj & "\'And 类别 = \'" & tjlb & "\'")
        For Each km1 As String In km1s
            dtb.AddDef( bb & km1 ,Gettype(Double),"", km1 &"_"& bb )
        Next
    Next
Next

代码执行结果:
图片点击可在新窗口打开查看此主题相关图片如下:1.png
图片点击可在新窗口打开查看
显示要求
图片点击可在新窗口打开查看此主题相关图片如下:2.png
图片点击可在新窗口打开查看
不知问题出在哪儿?请指教。谢谢!

--  作者:有点蓝
--  发布时间:2019/11/14 10:47:00
--  
Dim km1s() As String =  {"语文","数学","英语"}
        For Each km1 As String In km1s
    For Each bb As String In DataTables("目标设置").GetValues("部别", "[年级]= \'" & tjnj & "\'And 类别 = \'" & tjlb & "\'")

            dtb.AddDef( bb & km1 ,Gettype(Double),"", km1 &"_"& bb )
        Next
    Next
Next

--  作者:cqlpjks
--  发布时间:2019/11/14 11:03:00
--  
还是没变。
--  作者:有点蓝
--  发布时间:2019/11/14 11:11:00
--  
不可能
--  作者:cqlpjks
--  发布时间:2019/11/14 11:16:00
--  
还是上次那案例。
Dim Values() As String = {"总分"}
Dim s1() As String = New String() {"总分"}
Dim lm1s() As String = {"年级","类别","单位代码"}
Dim lm2s() As String = {"单位","项目"}
Dim dt As Table = Tables("成绩库")
Dim km1s() As String =  {"语文","数学","英语"}
Dim km2s() As String =  {"物理","化学","生物","政治","历史","地理"}
Dim tjnj As String = "2020"
Dim tjlb As String = "4期"
For Each Value As String In Values
    \'建表
    Dim bm As String = "高" & tjnj & "级" & tjlb & "市级重点有效分及贡献率统计表"
    Dim dtb As New DataTableBuilder(bm)
    For Each lm1 As String In lm1s
        dtb.AddDef(""& lm1 &"",Gettype(String),8)
    Next
    For Each lm2 As String In lm2s
        dtb.AddDef(""& lm2 &"",Gettype(String),8)
    Next
    For Each bb As String In DataTables("目标设置").GetValues("部别", "[年级]= \'" & tjnj & "\'And 类别 = \'" & tjlb & "\'")
        dtb.AddDef("总分"& bb ,Gettype(Double),"","总分上线_"& bb & "")
    Next
    For Each km1 As String In km1s
        For Each bb As String In DataTables("目标设置").GetValues("部别", "[年级]= \'" & tjnj & "\'And 类别 = \'" & tjlb & "\'")
            dtb.AddDef( bb & km1 ,Gettype(Double),"", km1 &"_"& bb )
        Next
    Next
    For Each km2 As String In km2s
        dtb.AddDef(""& km2 &"",Gettype(Double),"")
    Next    
    dtb.Build()
    \'表处理
    Tables( "高" & tjnj & "级" & tjlb & "市级重点有效分及贡献率统计表").SetHeaderRowHeight(35,35) \'表名的标题行的行高
    Tables( "高" & tjnj & "级" & tjlb & "市级重点有效分及贡献率统计表").DefaultRowHeight = 35 \'设置默认的行高
    Dim str As String = ""
    For Each lm1 As String In lm1s
        str = str & "|" & lm1 & "|40"
    Next
    For Each lm2 As String In lm2s
        str = str & "|" & lm2 & "|60"
    Next
    For Each bb As String In DataTables("目标设置").GetValues("部别", "[年级]= \'" & tjnj & "\'And 类别 = \'" & tjlb & "\'")
        For Each lm1 As String In lm1s
            Tables( "高" & tjnj & "级" & tjlb & "市级重点有效分及贡献率统计表").Cols(""& lm1 &"").TextAlign = TextAlignEnum.Center
        Next
        For Each lm2 As String In lm2s
            Tables( "高" & tjnj & "级" & tjlb & "市级重点有效分及贡献率统计表").Cols(""& lm2 &"").TextAlign = TextAlignEnum.Center
        Next
        Tables( "高" & tjnj & "级" & tjlb & "市级重点有效分及贡献率统计表").Cols("总分"& bb ).TextAlign = TextAlignEnum.Center
        str = str & "|总分" & bb & "|42"
    Next
    For Each bb As String In DataTables("目标设置").GetValues("部别", "[年级]= \'" & tjnj & "\'And 类别 = \'" & tjlb & "\'")
        For Each km1 As String In km1s
            str = str & "|"& bb & km1 &"|40"
        Next
    Next
    For Each km2 As String In km2s
        str = str & "|" & km2 & "|40"
    Next
    Tables( "高" & tjnj & "级" & tjlb & "市级重点有效分及贡献率统计表").SetColVisibleWidth("" & str.trim("|"))    
    \'统计
    
Next
StatusBar.Reset
StatusBar.DefaultMessage = "统计完毕!"
Tables("成绩库").ResumeRedraw



[此贴子已经被作者于2019/11/14 11:35:32编辑过]

--  作者:y2287958
--  发布时间:2019/11/14 11:18:00
--  
试用版?
--  作者:cqlpjks
--  发布时间:2019/11/14 11:28:00
--  
正版。
--  作者:有点蓝
--  发布时间:2019/11/14 11:35:00
--  
关闭退出项目,删除项目所在的文件夹里的bin目录,然后重启项目试试。
我这样测试没有问题。

Dim Values() As String = {"总分"}
Dim s1() As String = New String() {"总分"}
Dim lm1s() As String = {"年级","类别","单位代码"}
Dim lm2s() As String = {"单位","项目"}

Dim km1s() As String =  {"语文","数学","英语"}
Dim km2s() As String =  {"物理","化学","生物","政治","历史","地理"}

Dim tjnj As String = "2020"
Dim tjlb As String = "4期"
Dim bm As String = "高" & tjnj & "级" & tjlb & "市级重点有效分及贡献率统计表"
Dim dtb As New DataTableBuilder(bm)
For Each lm1 As String In lm1s
    dtb.AddDef(""& lm1 &"",Gettype(String),8)
Next
For Each lm2 As String In lm2s
    dtb.AddDef(""& lm2 &"",Gettype(String),8)
Next
Dim km2s222() As String =  {"高理","高文"}
For Each bb As String In km2s222
    dtb.AddDef("总分"& bb ,Gettype(Double),"","总分上线_"& bb & "")
Next
For Each km1 As String In km1s
    For Each bb As String In km2s222
        dtb.AddDef( bb & km1 ,Gettype(Double),"", km1 &"_"& bb )
    Next
Next
For Each km2 As String In km2s
    dtb.AddDef(""& km2 &"",Gettype(Double),"")
Next
dtb.Build()

--  作者:cqlpjks
--  发布时间:2019/11/14 11:41:00
--  
得行了。谢谢!