DataGridView复制到Excel格式

 

Clipboard.Clear()  清除剪贴板
        If DataGridView2.Rows.Count > 0 Then
            Dim a As New List(Of String)
            For i As Integer = 0 To DataGridView2.Rows.Count - 1
                Dim b(DataGridView2.Columns.Count - 3) As String
                For j As Integer = 1 To DataGridView2.Columns.Count - 2
                    b(j - 1) = DataGridView2.Rows(i).Cells(j).Value
                Next
                a.Add(String.Join(vbTab, b))
            Next

            Clipboard.SetText(String.Join(vbCrLf, a.ToArray))
            a = Nothing
        End If

 

DataGridView复制到Excel格式

上一篇:异常检测(三)之线性模型


下一篇:windows git