Dim Book As New XLS.Book(ProjectPath & "Attachments\卷宗管理台帐.xls") '打开模板
Dim fl As String = ProjectPath & "Reports\" & e.form.controls("TextBox1").text & "卷宗管理台帐.xls"
MessageBox.Show(e.form.controls("TextBox1").text)
Dim Sheet As XLS.Sheet = Book.Sheets(0)
With Sheet.PrintSetting
.PaperKind = 11 '设为A4纸
.LandScape = True '横向打印
.MarginLeft = 20 '左右边距设为20毫米
.MarginRight = 20
.MarginTop = 15 '上下边距设为15毫米
.MarginBottom = 15
End With
book.AddDataTable("卷宗入库","db","Select * f rom {卷宗入库} where 卷宗编号= '" & e.form.controls("TextBox1").text & "'")
book.AddDataTable("扫码录入","db","Select * f rom {扫码录入} where 卷宗编号= '" & e.form.controls("TextBox1").text & "'") '添加子表
book.AddDataTable("款物录入","db","Select * f rom {款物录入} where 案件编号= '" & e.form.controls("TextBox1").text & "'") '添加子表
book.AddRelation("卷宗入库","卷宗编号","扫码录入","卷宗编号") '建立关联
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿
Dim Proc As New Process
Proc.File = fl
Proc.Verb = "Print" '指定动作
Proc.Start()