Foxtable(狐表)用户栏目专家坐堂 → Importer


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

主题:Importer

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/10/29 14:28:00 [显示全部帖子]

Dim MyBook As New C1Excel.C1XLBook  '当前的Book
Dim str As String
Dim i,bi As Integer
i = 0
bi = 0
Dim dlg As New OpenFileDialog '定义一个新的OpenFileDialog
dlg.Filter= "Excel文件|*.xlsx|Excel文件|*.xls|Word文件|*.doc|Access文件|*.mdb" '设置筛选器
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
   
    MyBook.load(dlg.FileName)
    For Each sheet As C1Excel.XLSheet In MyBook.Sheets()
        str = sheet.name
        If i = bi Then
            Dim ip As New Importer
            ip.SourcePath = dlg.FileName '指定数据文件
            ip.SourceTableName = str '指定要导入的表
            ip.NewTableName = str '导入后的表名
            ip.Format = "Excel" '指定导入格式
            MessageBox.Show(ip.SourceTableName & "\" & ip.NewTableName &"\"& ip.Format)
            ip.Import()
            i += 1
            bi = i
        End If
    Next
End If

 回到顶部