代码
Dim tm As String = ProjectPath & "Attachments\提请议案.doc"
Dim fl As String = ProjectPath & "Reports\提请议案.doc"
Dim wrt As New WordReport(Tables("政府会议_任免"),tm,fl) '定义一个WordReport
wrt.Replace("[计数]",Tables("政府会议_任免").Compute("Count(姓名)")) '用代码计算出总的销售数量并替换模板中的合计
Dim str1 As String = ""
Dim str2 As String = ""
Dim filter = iif(Tables("政府会议_任免").Filter > "", Tables("政府会议_任免").Filter, "1=1")
Dim ls As List(Of String()) = Tables("政府会议_任免").DataTable.GetValues("姓名|拟任职务", filter & " and 拟任职务 is not null", "序列号")
For i As Integer = 0 To ls.Count - 1
Dim s() As String = ls(i)
Dim flag As String = ";" & vbcrlf & ""
If i = ls.Count-1 Then
flag = "."
End If
str1 &= s(0) & "同志任" & s(1) & flag
Next
ls = Tables("政府会议_任免").DataTable.GetValues("姓名|拟免职务", filter & " and 拟免职务 is not null", "序列号")
For i As Integer = 0 To ls.Count - 1
Dim s() As String = ls(i)
Dim flag As String = ";" & vbcrlf & ""
If i = ls.Count-1 Then
flag = "."
End If
str2 &= "免去" & s(0) & "同志" & s(1) & "职务" & flag
Next
wrt.Replace("[列表1]", str1)
wrt.Replace("[列表2]", str2)
'msgbox(str1 & str2 )
'wrt.Replace("[文号]",DataTables("任免表").GetComboListString("文号").Replace("|",","))
wrt.Build() '生成报表
wrt.Show() '显示报表