Dim tm As String = ProjectPath & "E:\\360云盘\\狐表程序\\wsm\\管理项目1\\Attachments\\A.doc" \'指定模板文件
Dim fl As String = ProjectPath & "E:\\360云盘\\狐表程序\\wsm\\管理项目1\\Reports\\A.doc" \'指定目标文件
Dim wrt As New WordReport(Tables("表A"),tm,fl) \'定义一个WordReport
wrt.Build() \'生成报表
Dim app As New MSWord.Application
try
Dim fileName = "E:\\360云盘\\狐表程序\\wsm\\管理项目1\\Reports\\A.doc"
Dim doc = app.Documents.Open(fileName)
doc.Protect (Password:="123456", NoReset:=False, Type:= _
MsWord.WdProtectionType.wdAllowOnlyReading, UseIRM:=False, EnforceStyleLock:=False)
app.Documents.save
catch ex As exception
msgbox(ex.message)
finally
app.Quit
wrt.Show() \'显示报表
End try