Dim tm As String = ProjectPath & "Attachments\干部任免审批表.doc" '指定模板文件 Dim fl As String = ProjectPath & "Reports\干部任免审批表.doc" '指定目标文件 Dim wrt As New WordReport(Tables("个人信息"),tm,fl) '定义一个WordReport Dim pdr As DataRow = Nothing Dim str As String = "" For Each dr As DataRow In DataTables("简历").Select("档案编号 = '" & Tables("个人信息").current("档案编号") & "'", "任职时间") If pdr IsNot Nothing Then str &= format(pdr("任职时间"), "yyyy年M月") & "到" & format(dr("任职时间").addmonths(-1), "yyyy年M月") &"在"& dr("单位名称")& dr("部门")& "任" & pdr("任职岗位") & chr(13) End If pdr = dr Next If pdr IsNot Nothing Then str &= format(pdr("任职时间"), "yyyy年M月") & "至今在" & pdr("单位名称")& pdr("部门")& "任" & pdr("任职岗位") End If wrt.Replace("[单位名称][部门][任职岗位]",str) '用代码计算出总的销售数量并替换模板中的合计标记 wrt.Build() '生成报表 wrt.Show() '显示报表
|