Dim t As Table = Tables("zhudan")
t.Select(0,0,t.rows.Count-1, t.cols.Count-1)
DataTables("zhudan").DeleteFor("kehu is null")
Dim Book As New XLS.Book(ProjectPath & "Attachments\ytoprint.xls") '打开模板
Dim fl As String = ProjectPath & "Reports\ytoprint.xls"
Dim Sheet As XLS.Sheet = Book.Sheets(0)
'Sheet(3,9).Value = "<日期 = # " & Date.Today & "#>" '写入打印条件
Book.Build() '生成报表
Book.Save(fl)
Dim obj As object = CreateObject("WScript.Network")
obj.SetDefaultPrinter("Gprinter GP-1124D")
Dim Proc As New Process
Proc.File = fl
Proc.Verb = "Print" '指定动作
Proc.Start()
用上面的这段代码 打印的话,五个文件会打印在一张纸内。
如果去掉紫色背景部分,每次打印可以打满1张纸