Dim str As String = "采购订单.xls"
If FileSys.FileExists(ProjectPath & "Attachments\" & str) Then
If Tables("订单主表.订单明细表").rows.count>0 Then
If e.Form.Controls("CheckBox2").Checked Then
Tables("订单主表.订单明细表").Select(0,0,Tables("订单主表.订单明细表").rows.count-1,0)
End If
Dim Book As New XLS.Book(ProjectPath & "Attachments\" & str)
Dim i As Integer
Dim str1 As String = "订单交期,联系人,联系方式,传真,订单号"
Dim str2 As String = "DateTimePicker1,TextBox3,TextBox1,TextBox2,TextBox4"
For Each k As String In str2.split(",")
Book.Marks.Add(str1.split(",")(i),e.form.Controls(k).Value)
i += 1
Next
Book.Build()
Book.Save(ProjectPath & "Reports\" & str)
Dim Proc As New Process
Proc.File = ProjectPath & "Reports\" & str
Proc.Start()
Else
msgbox("当前表无有记录!",64,"提示")
End If
Else
msgbox("找不到""" & str & """模板!",64,"提示")
End If