“住院记录”是父表,“护理评估”是子表,我在“护理评估”窗口中设了一个命令按钮并写了如下代码
Dim tm As String = ProjectPath & "Attachments\护理评估.doc" '指定模板文件
Dim fl As String = ProjectPath
& "Reports\护理评估.doc"
'指定目标文件
Dim wrt As New WordReport(Tables("护理评估"),tm,fl) '定义一个WordReport
wrt.Build() '逐行生成报表
wrt.quit
Dim app As New MSWord.Application
try
Dim fileName = fl
Dim doc = app.Documents.Open(fileName)
doc.Protect (Password:="123456",
NoReset:=False,
Type:= _
MsWord.WdProtectionType.wdAllowOnlyReading, UseIRM:=False, EnforceStyleLock:=False)
app.Documents.save
app.Visible = True
catch ex As exception
msgbox(ex.message)
app.Quit
finally
End try
结果显示
此主题相关图片如下:qqqqq.png
