Dim dlg As New SaveFileDialog '定义一个新的SaveFileDialog
dlg.Filter= "Excel文件|*.xls;*.xlsx" '设置筛选器
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
Dim Tab As WinForm.TabControl = e.Form.Controls("TabControl1")
For Each c As WinForm.Control In tab.Form.Controls
If TypeOf c Is WinForm.Table Then '判断控件是否是是表格
Dim t As WinForm.Table = c '使用特定类型的变量引用控件
Dim CurTable As Table =t.Table
Dim ex As New Exporter
Dim flg As New SaveExcelFlags
flg.VisibleOnly=False
ex.SourceTableName = CurTable.Name '指定导出表
ex.FilePath = dlg.FileName '指定目标文件 当多个Table对应一个文件名的时候,会转换成Excel的Sheet 就是这么神奇
ex.Format = "Excel" '导出格式为Excel
ex.Export() '开始导出
End If
Next
If MessageBox.Show("是否查看导出账页文件:"& dlg.FileName,"提示",MessageBoxButtons.YesNo,MessageBoxIcon.Question)=DialogResult.Yes Then
Dim Proc As New Process
Proc.File = dlg.FileName
Proc.Start()
End If
End If