以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 求助,导出excel表报错(超行数) (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=152602) |
-- 作者:way52133 -- 发布时间:2020/7/16 10:29:00 -- 求助,导出excel表报错(超行数) Dim dlg As New SaveFileDialog \'定义一个新的SaveFileDialog dlg.Filter= "EXCEL 文件|*.xlsx" \'设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮 \' MessageBox.Show("你要保存为:" & dlg.FileName,"提示") \'提示用户选择的文件 \' Dim ex As New Exporter \' ex.FilePath = dlg.FileName \'指定目标文件 Dim tb As Table Dim Book As New XLS.Book() \'(dlg.FileName) \' MessageBox.Show("dim book") Dim s As Integer =1 For Each tb In Tables If tb.name.Contains(".") Then Else book.Sheets.Add(tb.name) \' MessageBox.Show(tb.name) For c As Integer = 0 To tb.Cols.Count -1 \'添加列标题 book.Sheets(tb.name)(0, c).Value = tb.Cols(c).Name Next For r As Integer = 0 To tb.Rows.Count - 1 \'填入数据 For c As Integer = 0 To tb.Cols.Count -1 book.Sheets(tb.name)(r +1, c).Value = tb.rows(r)(c) Next Next End If Next \'打开工作簿 \'MessageBox.Show("add") Book.Save(dlg.FileName) Dim Proc As New Process Proc.File = dlg.FileName Proc.Start() End If |
-- 作者:有点蓝 -- 发布时间:2020/7/16 10:38:00 -- 先保存,重新打开文件,再导 Dim dlg As New SaveFileDialog \'定义一个新的SaveFileDialog dlg.Filter= "EXCEL 文件|*.xlsx" \'设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮 Dim tb As Table Dim Book As New XLS.Book() \'(dlg.FileName) Book.Save(dlg.FileName) Book = New XLS.Book(dlg.FileName) Dim s As Integer =1 For Each tb In Tables If tb.name.Contains(".") Then Else book.Sheets.Add(tb.name) …… |