Dim clbx1 As WinForm.CheckedListBox = e.Form.Controls("CheckedListBox1")
Dim clbx2 As WinForm.CheckedListBox = e.Form.Controls("CheckedListBox2")
For Each j As String In clbx2.CheckedIndices
Dim tm As String = ProjectPath & "模板文件\" & clbx2.Items(j) '指定模板文件
For Each i As Integer In clbx1.CheckedIndices
Dim fl As String = ProjectPath & "成品文件\" & clbx1.items(i) & clbx2.Items(j) '指定目标文件
Dim nm As String = CurrentTable.Name
Dim wrt As New WordReport(Tables(nm),tm,fl) '定义一个WordReport
Dim dr As DataRow =DataTables(nm).Find("名称 = '" & clbx1.items(i) & "'")
'文件已经存在,是否覆盖重新填写
If FileSys.FileExists(fl) Then
If MessageBox.Show(fl & "文件已经存在,是否覆盖重新填写?","提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
'是
Else
'否
End If
End If
'
If dr IsNot Nothing
wrt.BuildOne(dr)
wrt.quit
Dim proc As new Process
proc.File = fl '覆盖写入
'proc.Start
MessageBox.Show("生成完毕!")
End If
Next
Next