这个设置的是明细表的条件,不是主单的条件。
Dim dic As new Dictionary(Of String, String)
For Each r As Row In Tables("T_Report.T_Item").GetCheckedRows
r("开单状态") = True
If dic.ContainsKey(r("表单编号")) = False Then
dic.add(r("表单编号"), r("_Identify"))
Else
dic(r("表单编号")) = dic(r("表单编号")) & "," & r("_Identify")
End If
Next
For Each key As String In dic.Keys
Tables("T_Report.T_Item").Filter = "[_Identify] in (" & dic(key) & ")"
Dim Book As New XLS.Book(ProjectPath & "Attachments\" & key & ".xls")
Dim fl As String = ProjectPath & "Reports\" & Tables("T_Report").current("报告编号")& "&" & key & ".xls"
vars("编号") = key
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿
Dim Proc As New Process '打开工作簿
Proc.File = fl
Proc.Start()
Next
Tables("T_Report.T_Item").Filter = ""