以下是引用Bin在2014-1-18 9:02:00的发言:那要使用代码导出的方式才可以做到.
BIN 大哥 能不能帮忙改改 首先是 代码还有点错误 只导出了一个表,另外希望 能用SaveFileDialog保存到用户自己选择的路径呢?
'Dim dlg As New SaveFileDialog '定义一个新的SaveFileDialog
'dlg.Filter= "Excel文件(*.xlsx;*.xls)|*.xlsx;*.xls" '设置筛选器
'If dlg.ShowDialog = DialogResult.Ok Then
For Each t As Table In Tables
If t.Name = "Awards" Then
Continue For
Else
Dim dt As Table = Tables(t.name)
Dim Book As New XLS.Book '定义一个Excel工作簿
Book.Sheets.Add(t.name)
Dim Sheet As XLS.Sheet = Book.Sheets(t.name)
For r As Integer = 0 To dt.Rows.Count - 1 '填入数据
For c As Integer = 0 To dt.Cols.Count -1
Sheet(r,c).Value = dt.rows(r)(c)
Next
Next
Book.Save("c:\reports\test.xls")
End If
Next
Dim Proc As New Process
Proc.File = "c:\reports\test.xls"
Proc.Start()
'End If
'Next
'MessageBox.Show("导出完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
'End If
[此贴子已经被作者于2014-1-18 9:59:07编辑过]