预览和生成分开处理,用下面代码预览
Dim tm As String = ProjectPath & "Attachments\人员简历表.doc" '指定模板文件
With Tables("员工资料")
If .TopPosition > -1 Then '如果选定区域包括数据行
Dim fileName As String = ProjectPath & "Reports\预览.doc" '指定目标文件
Dim wrt As New WordReport(Tables("员工资料"),tm,fileName) '定义一个WordReport
For i As Integer = .TopPosition To .BottomPosition
Dim r As Row = .Rows(i)
wrt.BuildOne(r)
Next
wrt.Show() '显示报表
End If
End With