执行后对话框“OK1”出现,“OK2”和“OK3”始终不出现
代码如下:
'--"M00_主界面" "2_BTN2_15生成概览"-------------
Dim YearStart, YearEnd As Integer
Dim dt As DataTable = DataTables("学习班历史数据")
YearStart = Math.Max(e.Form.Controls("2_NCB2_13起始年度").Value,dt.Compute("Min(年度)"))
e.Form.Controls("2_NCB2_13起始年度").Value = YearStart
YearEnd = Math.Min(e.Form.Controls("2_NCB2_14终止年度").Value,dt.Compute("Max(年度)"))
e.Form.Controls("2_NCB2_14终止年度").Value = YearEnd
If YearStart > YearEnd Then
MessageBox.Show("起始年度不能超过终止年度!")
Return
End If
Dim Fstr As String = "年度 >= " & YearStart & " And 年度 <= " & YearEnd
'-----分项统计:年度、期数-----------------
Dim drs As List(Of DataRow) = dt.Select(Fstr)
Dim ReportName As String = ProjectPath & "项目信息\学习班简报\概览_" & IIF(YearStart = YearEnd, YearEnd, YearStart & " - " & YearEnd) & "年度" & ".doc"
Dim TemplateName As String = ProjectPath & "报表模板\T33_ISCD学习班概览_模板.doc"
'-----生成"学习班简报"-----------------
Dim wrt As New WordReport(Tables("学习班历史数据"), TemplateName, ReportName)
'-----筛选范围-----------------
wrt.Replace("[A00]",IIF(YearStart = YearEnd, YearEnd, YearStart & " - " & YearEnd) & "年度")
'-----分项统计:年度、期数-----------------
wrt.Replace("[A01]",IIF(YearStart = YearEnd,YearStart & "年", "从" & YearStart & "年 至 " & YearEnd & "年") & " 历时 " & Cstr(YearEnd - YearStart + 1) & " 年")
wrt.Replace("[A02]","共举办了" & drs.Count & "期")
'-----分项统计:办班地域-----------------
Dim Provs As List(Of String) = dt.GetValues("省" ,Fstr)
Dim StrProvs As String = dt.GetComboListString("省",Fstr,"省").Replace("|","、")
Dim Citys As List(Of String) = dt.GetValues("城市",Fstr)
Dim StrCitys As String = dt.GetComboListString("城市",Fstr,"省,城市").Replace("|","、")
wrt.Replace("[A03]","全国" & Provs.Count & "个省市区" & "(" & StrProvs & ")" & "的" & Citys.Count & "座城市" & "(" & StrCitys & ")")
MessageBox.Show("OK1")
'---生成概览文件------------------------------
wrt.BuildOne(drs(0))
MessageBox.Show("OK2")
wrt.Quit()
MessageBox.Show("OK3")
MessageBox.Show("学习班概览文件生成!")