试试
Dim s1 As String =args(0)'替换文本
Dim s2 As String =args(1)'替换内容1
Dim s3 As String = args(2) '替换图片
Dim tm As String = ProjectPath & "Attachments\xgx.doc" '指定模板文件
Dim fl As String = ProjectPath & "相关性图\xgx" & s3 & ".doc" '指定目标文件
Dim wrt As New WordReport(Tables("xgb"),tm,fl) '定义一个WordReport fxygx" & Vars("_xz7") & ".wmf")'
Try
wrt.replace("[文本]",s1)
wrt.replace("[内容1]",s2)
wrt.ReplaceWithImage("[&&xgx.wmf,400,300]",ProjectPath & "相关性图\fxygx" & s3 & ".wmf",400,300) '
wrt.Build()
wrt.quit '退出报表
Catch ex As Exception
wrt.quit
messagebox.show("程序异常错误,可能进程中存在已打开的word程序,请关闭后再运行!")
End Try