以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  行颜色设置  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=95442)

--  作者:刘林
--  发布时间:2017/1/19 20:08:00
--  行颜色设置
老师,请问临时表手工生成了汇总行,表中有汇总标识列,我想让汇总行和全区汇总行显示为蓝色,怎么用代码来写
--  作者:有点色
--  发布时间:2017/1/20 1:13:00
--  

 要修改样式

 

http://www.foxtable.com/webhelp/scr/1577.htm

 


--  作者:刘林
--  发布时间:2017/1/21 17:57:00
--  
老师,问题是我不并不是真正的汇总行,是手机增加的汇总行
--  作者:刘林
--  发布时间:2017/1/21 17:59:00
--  
Dim t As Table = Tables("期末_table6")
t.Cols.Frozen = 6
\'t.sort = "考试名称,年级,类别,学校班级"

Dim Ays As List(Of String())
Ays = t.DataTable.GetValues("考试名称|年级|类别") \'列名用符号|分割
Dim jAys As List(Of String())
jAys = t.DataTable.GetValues("考试名称|年级") \'列名用符号|分割

t.StopRedraw
For Each Ay As String() In Ays
    Dim f As String = "考试名称=\'" & Ay(0) & "\' And 年级=\'" & Ay(1) & "\' and 类别=\'" & Ay(2) & "\'"
    Dim r As Row = t.AddNew()
    r("考试名称") = ay(0)
    r("年级") = Ay(1)
    r("类别") = Ay(2)
    r("汇总标识") = "汇总"
    r("学校班级") = t.Compute("Count(学校班级)",f) & "班合计"
    r("参考数") =  t.Compute("Sum(参考数)",f)
    r("语文_人平") = t.compute("sum(语总)",f)/ r("参考数")
    r("数学_人平") = t.compute("sum(数总)",f)/  r("参考数")
    r("总分_人平") = t.compute("sum(总分)",f)/  r("参考数")
    r("语文_优秀率") = t.compute("sum(语文_优数)",f)/r("参考数")
    r("数学_优秀率") = t.compute("sum(数学_优数)",f)/r("参考数")
    r("语文_及格率") = t.compute("sum(语文_及数)",f)/r("参考数")
    r("数学_及格率") = t.compute("sum(数学_及数)",f)/r("参考数")
    If val(ay(1)) > 6
        r("英语_人平") = t.compute("sum(英总)",f)/  r("参考数")
        r("政治_人平") = t.compute("sum(政总)",f)/  r("参考数")
        r("历史_人平") = t.compute("sum(历总)",f)/ r("参考数")
        r("生物_人平") = t.compute("sum(生总)",f)/  r("参考数")
        r("地理_人平") = t.compute("sum(地总)",f)/  r("参考数")
        r("英语_优秀率") = t.compute("sum(英语_优数)",f)/r("参考数")
        r("政治_优秀率") = t.compute("sum(政治_优数)",f)/r("参考数")
        r("历史_优秀率") = t.compute("sum(历史_优数)",f)/r("参考数")
        r("生物_优秀率") = t.compute("sum(生物_优数)",f)/r("参考数")
        r("地理_优秀率") = t.compute("sum(地理_优数)",f)/r("参考数")
        r("英语_及格率") = t.compute("sum(英语_及数)",f)/r("参考数")
        r("政治_及格率") = t.compute("sum(政治_及数)",f)/r("参考数")
        r("历史_及格率") = t.compute("sum(历史_及数)",f)/r("参考数")
        r("生物_及格率") = t.compute("sum(生物_及数)",f)/r("参考数")
        r("地理_及格率") = t.compute("sum(地理_及数)",f)/r("参考数")
    End If
    If val(ay(1)) >7
        r("物理_人平") = t.compute("sum(物总)",f)/  r("参考数")
        r("物理_优秀率") = t.compute("sum(物理_优数)",f)/r("参考数")
        r("物理_及格率") = t.compute("sum(物理_及数)",f)/r("参考数")
    End If
    If val(ay(1)) >8
        r("化学_人平") = t.compute("sum(化总)",f)/ r("参考数")
        r("化学_优秀率") = t.compute("sum(化学_优数)",f)/r("参考数")
        r("化学_及格率") = t.compute("sum(化学_及数)",f)/r("参考数")
    End If
Next

我是用上面代码增加的汇总行,不是真正的汇总行,我想把手工增加的汇总行的用颜色的区别显示

--  作者:小马甲
--  发布时间:2017/1/21 22:31:00
--  

加一个辅助列,初始为0

 

自己增加的设为1

 

 

然后用样式就行了


--  作者:刘林
--  发布时间:2017/1/22 9:38:00
--  
写不来,生成的表是临时表,我自己增加的行增加了辅助列"汇总",请帮写下代码,谢谢
--  作者:有点色
--  发布时间:2017/1/22 10:15:00
--  
以下是引用刘林在2017/1/22 9:38:00的发言:
写不来,生成的表是临时表,我自己增加的行增加了辅助列"汇总",请帮写下代码,谢谢

 

去写全局表drawcell事件。

 

If e.Table.Name = "期末_table6" Then
    If e.Row("汇总") = "汇总" Then
        e.Table.DataTable.AddUserStyle("样式1", color.red, color.Black)
        e.style = "样式1"
    End If
End If

http://www.foxtable.com/webhelp/scr/0671.htm

 

生成table的代码,加上代码

 

Tables("期末_table6").DataTable.GlobalHandler.DrawCell = true