代码如下,有的是我的业务逻辑,我就不删除了
Dim gm As FarPoint.Win.Spread.Model.GroupDataModel
gm = FpSpread1.ActiveSheet.Models.Data
If IsNothing(gm) = False Then
gm.SuspendGrouping = False
gm.Group(value)
For i = 0 To FpSpread1.ActiveSheet.NonEmptyRowCount - 1
If gm.IsGroup(i) Then
Dim g As FarPoint.Win.Spread.Model.Group = gm.GetGroup(i)
Dim column As Int32 = g.Column
Dim s As String = gm.TargetModel.GetValue(getRow(g), column).ToString()
Dim column_name As String = FpSpread1.ActiveSheet.Columns(g.Column).Tag.ToString.Trim
Dim dr As DataRow = find_select_list(column_name)
Dim group_text As String = s
If IsNothing(dr) = False Then
If IsDBNull(dr("Sub_column")) = True OrElse dr("Sub_column") > -1 Then '-1表示该字段是子列,已经被指定
Dim sql As String = Replace(dr("SQL_export").ToString, "@Unit_id@", form_load.frm_SPI_LOAD.unit_id)
sql = sql.Replace("[", "").Replace("]", "")
Dim dt As DataTable = cl_common.fc_Get_Datatable(sql)
If IsNothing(dt) = False Then
Dim column_name_temp As String = dt.Columns(0).ColumnName
Dim dr2 As DataRow() = dt.Select(column_name_temp & "=" & s)
If dr2.Count > 0 Then
group_text = dr2(0)(1)
End If
End If
End If
End If
g.Text = group_text
End If
Next
gm.SuspendGrouping = True
value = gm.SortInfo
FpSpread1.ResumeLayout()
End If |