Dim wellname As WinForm.ComboBox = e.Form.Controls("井名") Dim layername As WinForm.ComboBox = e.Form.Controls("小层名") Dim dlg As New SaveFileDialog '定义一个新的SaveFileDialog dlg.Filter= "Excel文件|*.xls" '设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮 Dim ex As New Exporter ex.Format = "excel" ex.SourceTableName = "含气量统计表" '指定导出表 Dim Filter As String = "1=1" If e.Form.Controls("井名").Text > "" Filter = filter & " and 井名 = '" & welname.Text & "'" End If If e.Form.Controls("小层名").Text > "" Then Filter = Filter & " and 小层名 = '" & layername.text & "'" End If ex.Filter = Filter ex.filepath = dlg.FileName '指定目标文件 ex.Export() '开始导出 End If
|