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


  共有2913人关注过本帖平板打印复制链接

主题:Importer

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/4/21 16:12:00 [只看该作者]

Dim dlg As new OpenFileDialog
dlg.Filter = "Excel|*.xls;*.xlsx"
If dlg.ShowDialog = DialogResult.OK Then
    Dim book As new XLS.Book(dlg.FileName)
    For Each sheet As XLS.Sheet In book.Sheets
        Dim Result As DialogResult
        Result = MessageBox.Show("是否要导入" & sheet.name & "表", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
        If Result = DialogResult.Yes Then
            Dim ip As New Importer
            ip.SourcePath = dlg.FileName
            ip.SourceTableName =  sheet.Name & "$" '指定要导入的表
            ip.NewTableName = sheet.name.trim()  '导入后的表名
            ip.Format = "Excel" '指定导入格式
            ip.Import()
        End If
    Next
End If

 回到顶部
总数 14 1 2 下一页