我在C版的基础上改一下
粘贴排除隐藏列:
Dim t As Table = CurrentTable
Dim s As String = System.Windows.Forms.ClipBoard.GetText()
Dim Lines() As String = s.split(chr(13) & chr(10))
Dim Count As Integer = Math.Min(Lines.Length , t.Rows.Count - t.TopPosition) - 1
For n As Integer = 0 To Count
Dim Line() As String = Lines(n).Split(chr(9))
Dim r As Integer = t.TopPosition + n
Dim vp As Integer = 0
For c As Integer = t.LeftCol to t.Cols.Count - 1
If t.Cols(c).Visible Then
If vp < Line.Length Then
t.Rows(r)(c) = Line(vp)
End If
vp = vp + 1
End If
Next
Next
粘贴考虑隐藏列:
Dim t As Table = CurrentTable
Dim s As String = System.Windows.Forms.ClipBoard.GetText()
Dim Lines() As String = s.split(chr(13) & chr(10))
Dim Count As Integer = Math.Min(Lines.Length,t.Rows.Count - t.TopPosition) - 1
For n As Integer = 0 To Count
Dim Line() As String = Lines(n).Split(chr(9))
Dim r As Integer = t.TopPosition + n
Dim vp As Integer = 0
For c As Integer = t.LeftCol to t.Cols.Count - 1
If vp < Line.Length Then
t.Rows(r)(c) = Line(vp)
End If
vp = vp + 1
Next
Next
[此贴子已经被作者于2010-6-28 10:20:23编辑过]