Dim dlg As New SaveFileDialog '定义一个新的SaveFileDialog
dlg.Filter= "Excel文件|*.xlsx;*.xls" '设置筛选器'
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
Dim ex As New Exporter
output.show(dlg.FileName)
ex.SourceTableName = "库存明细" '指定导出表
Dim a As String = dlg.FileName
ex.FilePath = a ' "c:\Data\库存明细5.xls" '指定目标文件
if a.EndsWith(".xls") then
ex.Format = "Excel" '导出格式为Excel
else
ex.Format = "Excel2007" '导出格式为Excel2007
end if
ex.Export() '开始导出
End If