Foxtable(狐表)用户栏目专家坐堂 → 当从EXECL中一次性地复制多列数据到当前表中的时候


  共有17965人关注过本帖树形打印复制链接

主题:当从EXECL中一次性地复制多列数据到当前表中的时候

帅哥哟,离线,有人找我吗?
mr725
  21楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:MVP荣誉狐 帖子:5154 积分:31434 威望:0 精华:8 注册:2008/9/8 12:27:00
  发帖心情 Post By:2010/6/29 19:02:00 [只看该作者]

贴出代码 并 提供你的文件来测试一下看······

 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  22楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251060 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2010/6/29 19:17:00 [只看该作者]

改一下:

 

Dim t As Table = CurrentTable
Dim s As String = System.Windows.Forms.ClipBoard.GetText()
Dim Lines() As String = s.split(chr(13))
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).Trim(chr(10)).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


 回到顶部
帅哥哟,离线,有人找我吗?
yankunhao
  23楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:五尾狐 帖子:1028 积分:7211 威望:0 精华:0 注册:2008/9/1 22:34:00
  发帖心情 Post By:2010/6/29 21:34:00 [只看该作者]

以下是引用狐狸爸爸在2010-6-29 19:17:00的发言:

改一下:

 

Dim t As Table = CurrentTable
Dim s As String = System.Windows.Forms.ClipBoard.GetText()
Dim Lines() As String = s.split(chr(13))
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).Trim(chr(10)).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

 

 

这个是含隐藏列的,请问排除隐藏列的有如何呢?


 回到顶部
帅哥哟,离线,有人找我吗?
yankunhao
  24楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:五尾狐 帖子:1028 积分:7211 威望:0 精华:0 注册:2008/9/1 22:34:00
  发帖心情 Post By:2010/6/29 21:48:00 [只看该作者]

以下是排除隐藏列的:

Dim t As Table = CurrentTable
Dim s As String = System.Windows.Forms.ClipBoard.GetText()
Dim Lines() As String = s.split(chr(13))
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).Trim(chr(10)).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


 回到顶部
总数 24 上一页 1 2 3