Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
mark 合并模式
Dim t As Table = Tables("表a")
Dim cs As String() = {"第一列", "第二列", "第五列"}
'取消合并
Dim ls As new List(of object)
For Each r As object In t.Grid.MergedRanges
ls.add(r)
Next
For Each r As object In ls
t.Grid.MergedRanges.Remove(r)
Next
'设置合并
For i As Integer = 0 To cs.length-1
Dim top As Integer = 0
For j As Integer = 1 To t.Rows.count-1
Dim r1 As Row = t.Rows(j-1)
Dim r2 As Row = t.Rows(j)
Dim same As Boolean = True
For k As Integer = 0 To i
If r1(cs(k)) <> r2(cs(k)) Then
same = False
Exit For
End If
Next
If same = False Then
t.Grid.AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.Custom
Dim rng As C1.Win.C1FlexGrid.CellRange = t.Grid.GetCellRange(top+t.HeaderRows, t.cols(cs(i)).Index+1, j+t.HeaderRows-1, t.cols(cs(i)).Index+1)
t.Grid.MergedRanges.add(rng)
Top = j
ElseIf j = t.rows.count-1 Then
Dim rng As C1.Win.C1FlexGrid.CellRange = t.Grid.GetCellRange(top+t.HeaderRows, t.cols(cs(i)).Index+1, j+t.HeaderRows, t.cols(cs(i)).Index+1)
t.Grid.MergedRanges.add(rng)
End If
Next
Next
这里改成自己的表和列
Dim t As Table = Tables("表a")
Dim cs As String() = {"第一列", "第二列", "第五列"}