我想一键打印选定的记录和每个记录打印的张数
此主题相关图片如下:snap1.jpg
以下是【打印合格证】按钮代码,只能打印选定的记录,没有包括张数。
Dim cbx As WinForm.ComboBox = e.Form.Controls("合格证模板")
Tables("打印").Filter = "[合格证模板] = '" & cbx.text & "' And [打印] = False "
If Tables("打印").Rows.Count = 0 Then '如果是一个空表
MessageBox.Show("没有要打印的数据!", "提示")
Return '那么返回
Else
'选定筛选的表
With Tables("打印")
.Select(0,0, .Rows.Count -1, .Cols.Count -1)
End With
End If
Dim Book As New XLS.Book(ProjectPath & "Attachments\" & cbx.text & ".xls")
Book.Build()
Book.Save(ProjectPath & "Reports\" & cbx.text & ".xls")
Dim Proc As New Process
Proc.File = ProjectPath & "Reports\" & cbx.text & ".xls"
Proc.Start()
For Each r As Row In Tables("打印").Rows
r("打印") = True
Next
Tables("打印").Filter = "[打印] = False"