Foxtable(狐表)用户栏目专家坐堂 → [求助]按条件实现表格填充样式?


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

主题:[求助]按条件实现表格填充样式?

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


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

1、参考 http://www.foxtable.com/webhelp/scr/0656.htm

 

2、你的逻辑是什么?临时设置样式,参考

 

Dim t As Table = Tables("表A")
Dim cs1 As C1.Win.C1FlexGrid.CellStyle = t.Grid.Styles.Add("样式1")
cs1.backcolor = Color.red
cs1.Border.Direction = 2
t.Grid.SetCellStyle(1, 1, cs1)
t.Grid.SetCellStyle(2, 1, cs1)


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


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

Dim t As Table = Tables("表A")
Dim cs1 As C1.Win.C1FlexGrid.CellStyle = t.Grid.Styles.Add("样式1")
cs1.backcolor = Color.red
Dim cs2 As C1.Win.C1FlexGrid.CellStyle = t.Grid.Styles.Add("样式2")
cs2.backcolor = Color.green

For i As Integer = t.Position To t.Rows.count-1
   
    If i <> t.Position Then
        If t.Rows(i)("第二列") <> t.Rows(i-1)("第二列") Then
            t.position = i
            Exit For
        End If
        If t.Rows(i)("第一列") <> t.Rows(i-1)("第一列") Then
            t.Grid.SetCellStyle(i+1, 1, cs2)
        Else
            t.Grid.SetCellStyle(i+1, 1, cs1)
        End If
    Else
        t.Grid.SetCellStyle(i+1, 1, cs1)
    End If
Next


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


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

先点击排序,再分析

 

Dim t As Table = Tables("同品名异归类")
Dim cs1 As C1.Win.C1FlexGrid.CellStyle = t.Grid.Styles.Add("样式1")
cs1.backcolor = Color.red
Dim cs2 As C1.Win.C1FlexGrid.CellStyle = t.Grid.Styles.Add("样式2")
cs2.backcolor = Color.green
Dim idx = t.grid.Cols("商品编码").Index
For i As Integer = t.Position To t.Rows.count-1
   
    If i <> t.Position Then
        If t.Rows(i)("商品名称") <> t.Rows(i-1)("商品名称") Then
            t.position = i
            Exit For
        End If
        If t.Rows(i)("商品编码") <> t.Rows(i-1)("商品编码") Then
            t.Grid.SetCellStyle(i+1, idx, cs2)
        Else
            t.Grid.SetCellStyle(i+1, idx, cs1)
        End If
    Else
        t.Grid.SetCellStyle(i+1, idx, cs1)
    End If
Next


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


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

先点击排序,再分析

 

Dim t As Table = Tables("同品名异归类")
Dim cs1 As C1.Win.C1FlexGrid.CellStyle = t.Grid.Styles.Add("样式1")
cs1.backcolor = Color.red
Dim cs2 As C1.Win.C1FlexGrid.CellStyle = t.Grid.Styles.Add("样式2")
cs2.backcolor = Color.green
Dim idx = t.grid.Cols("商品编码").Index
For i As Integer = t.Position To t.Rows.count-1
   
    If i <> t.Position Then
        If t.Rows(i)("商品名称") <> t.Rows(i-1)("商品名称") Then
            t.position = i
            Exit For
        End If
        If t.Rows(i)("商品编码") <> t.Rows(i-1)("商品编码") Then
            t.Grid.SetCellStyle(i+1, idx, cs2)
        Else
            t.Grid.SetCellStyle(i+1, idx, cs1)
        End If
    Else
        t.Grid.SetCellStyle(i+1, idx, cs1)
    End If
Next


 回到顶部