Dim r As Row = Tables("理化检测_table3").Current
r("报告日期") = Date.Today()
Dim tmfx As String = ProjectPath & "Attachments\分析报告模板.doc" '指定模板文件
Dim tmjx As String = ProjectPath & "Attachments\金相报告模板.doc"
Dim tmhg As String = ProjectPath & "Attachments\化工报告模板.doc"
Dim tmxn As String = ProjectPath & "Attachments\性能报告模板.doc"
Dim tmwsjc As String = ProjectPath & "Attachments\无损检测报告模板.doc"
Dim f As String = ProjectPath & "attachments\Reports\" & e.form.controls("TextBox9").Text & ".doc" '指定目标文件
If user.group = "分析室" Then
Dim wrtfx As New WordReport(Tables("理化检测_table3"),tmfx,f) '定义一个WordReport
wrtfx.Build() '逐行生成报表
wrtfx.quit() '退出报表
ElseIf user.group = "金相室" Then
Dim wrtjx As New WordReport(Tables("理化检测_table3"),tmjx,f)
wrtjx.Build()
wrtjx.quit()
ElseIf user.group = "化工室" Then
Dim wrthg As New WordReport(Tables("理化检测_table3"),tmhg,f)
wrthg.Build()
wrthg.quit()
ElseIf user.group = "性能室" Then
Dim wrtxn As New WordReport(Tables("理化检测_table3"),tmxn,f)
wrtxn.Build()
wrtxn.quit()
ElseIf user.group = "无损检测" Then
Dim wrtwsjc As New WordReport(Tables("理化检测_table3"),tmwsjc,f)
wrtwsjc.Build()
wrtwsjc.quit()
End If
Forms("检测报告").open
Dim wbr As WinForm.WebBrowser = Forms("检测报告").Controls("WebBrowser1")
wbr.OfficeToolBar = False
Dim file As String
file= ProjectPath & "attachments\Reports\" & Forms("理化检测").controls("TextBox9").Text & ".doc"
If file > "" Then
Dim web As Object = wbr.basecontrol
web.Navigate(file)
Do Until axWebBrowser IsNot Nothing
Application.DoEvents
Loop
Dim oDocument As object = axWebBrowser.Gettype().InvokeMember("Document", System.Reflection.BindingFlags.GetProperty, Nothing, axWebBrowser, Nothing)
Dim oApplication As object = axWebBrowser.Gettype().InvokeMember("Application", System.Reflection.BindingFlags.GetProperty, Nothing, oDocument, Nothing)
vars("doc") = oDocument
End If