Dim tb As Table = Tables("表A") tb.Grid.AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.Custom Dim rng As C1.Win.C1FlexGrid.CellRange = tb.Grid.GetCellRange(3, 2, 5, 2) \'从坐标3,2合并到5,2 tb.Grid.MergedRanges.add(rng)
\'取消合并 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
\'设置合并 Dim i As Integer = t.Cols("第一列").Index Dim ii As Integer = t.Cols("第二列").Index 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
If r2(i) = Nothing OrElse r1(i) <> r2(i) Then same = False End If
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, ii+1, j+t.HeaderRows-1, ii+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, ii+1, j+t.HeaderRows, ii+1) t.Grid.MergedRanges.add(rng) End If Next
Dim dt As DataTable = DataTables("表A") For Each xm As String In dt.GetValues("姓名") Dim bzs As String = dt.GetComboListString("备注", "姓名=\'" & xm & "\'") dt.ReplaceFor("备注", bzs, "姓名=\'" & xm & "\'") Next