1、
Dim lst As WinForm.ListBox = e.Form.Controls("ListBox1")
If lst.SelectedValue IsNot Nothing Then
Dim tbx As WinForm.TextBox = e.Form.Controls("TextBox1")
Dim Book As New XLS.Book(ProjectPath & "Attachments\" & lst.SelectedValue )
If tbx.value IsNot Nothing Then
Dim dlg As new SaveFileDialog
dlg.Filter = "excel|*.xls"
dlg.InitialDirectory = ProjectPath & "报表\"
dlg.FileName = tbx.value & ".xls"
If dlg.ShowDialog = DialogResult.OK Then
Dim fl As String = dlg.FileName
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Book.Build() '生成报表
Book.Save(fl)
Proc.File = fl
Proc.Start()
End If
Else MessageBox.Show("请填写报表名称!","温馨提示:")
End If
Else MessageBox.Show("请选择报表模板!","温馨提示:")
End If
[此贴子已经被作者于2018/8/10 17:03:07编辑过]