word报表,我现在在页眉引用了报告编号,这样写代码虽然可以实现,但感觉不够简练,可否改进?另外就是关闭的时候会提示是否要保存,可否不提示?Dim t As Table = CurrentTable
Dim tm As String = ProjectPath & "Attachments\报告.doc" '指定模板文件
Dim fl As String = ProjectPath & "Reports\报告.doc"
Dim wrt As New WordReport(t,tm,fl) '定义一个WordReport
wrt.Build() '逐行生成报表
wrt.Quit
Dim app As New MSWord.Application
try
Dim doc As Object = app.Documents.Open(fl)
app.ActiveWindow.ActivePane.View.SeekView = MSWord.WdSeekView.wdSeekCurrentPageHeader
app.ActiveWindow.Selection.TypeText(Text:= t.Current("报告编号"))
app.ActiveWindow.ActivePane.View.SeekView = MSWord.WdSeekView.wdSeekMainDocument
app.Visible = True
catch ex As exception
msgbox(ex.message)
app.Quit
finally
'app.Quit
End try