老师好! 我想根据某行的不同值,自动选择不同的打印模板。可是,有困难呀!
这是我的代码:
Select Case e.DataCol.Name
Case "订单种类"
If e.DataRow("订单种类") = "开发样品" Or e.DataRow("订单种类") = "修订样品" Or e.DataRow("订单种类") = "常规样品" Then '如果样品单,则打印样品评审单
Dim Book As New XLS.Book(ProjectPath & "Attachments\样品评审单.xls")'打开模板
Dim fl As String = ProjectPath & "Reports\样品评审单.xls"
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿
Dim Proc As New Process '打开工作簿
Proc.File = fl
Proc.Verb = "Print" '指定动作
Proc.Start()
End If
End Select
Select Case e.DataCol.Name
Case "订单种类"
If e.DataRow("订单种类") <> "开发样品" Or e.DataRow("订单种类") <> "修订样品" Or e.DataRow("订单种类") <> "常规样品" Then '如果不是样品单
Dim Book As New XLS.Book(ProjectPath & "Attachments\合同评审表.xls")'打开模板
Dim fl As String = ProjectPath & "Reports\合同评审表.xls"
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿
Dim Proc As New Process '打开工作簿
Proc.File = fl
Proc.Verb = "Print" '指定动作
Proc.Start()
End If
End Select
谢谢老师指正!