以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  选择模板  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=66179)

--  作者:信达
--  发布时间:2015/3/31 16:55:00
--  选择模板

老师,

 

根据条件选择打印模板,是在菜单的Click中写入代码还是?

 

\'Dim dr As DataRow
\'If dr("客户简称") = "A客户" Then
Dim Book As New XLS.Book(ProjectPath & "Attachments\\A客户合同明细.xls")
Dim fl As String = ProjectPath & "Reports\\QD" & Format(Date.Today,"yyyyMMdd") & ".xls"
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Sheet(4,14).Value = "A" & Format(Date.Today, "yyMMdd") \'写入合同编号
Book.Build() \'生成细节区
Book.Save(fl) \'保存工作簿
Dim Proc As New Process \'打开工作簿
Proc.File = fl
Proc.Start()

Else

Dim Book As New XLS.Book(ProjectPath & "Attachments\\B客户合同明细.xls")
Dim fl As String = ProjectPath & "Reports\\QD" & Format(Date.Today,"yyyyMMdd") & ".xls"
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Sheet(4,14).Value = "B" & Format(Date.Today, "yyMMdd") \'写入合同编号
Book.Build() \'生成细节区
Book.Save(fl) \'保存工作簿
Dim Proc As New Process \'打开工作簿
Proc.File = fl
Proc.Start()

End If


--  作者:有点甜
--  发布时间:2015/3/31 16:59:00
--  

 呃,都可以

 

Dim dr As Row = Tables("表A").Current
If dr("客户简称") = "A客户" Then

    Dim Book As New XLS.Book(ProjectPath & "Attachments\\A客户合同明细.xls")
    Dim fl As String = ProjectPath & "Reports\\QD" & Format(Date.Today,"yyyyMMdd") & ".xls"
    Dim Sheet As XLS.Sheet = Book.Sheets(0)
    Sheet(4,14).Value = "A" & Format(Date.Today, "yyMMdd") \'写入合同编号
    Book.Build() \'生成细节区
    Book.Save(fl) \'保存工作簿
    Dim Proc As New Process \'打开工作簿
    Proc.File = fl
    Proc.Start()
   
Else
   
    Dim Book As New XLS.Book(ProjectPath & "Attachments\\B客户合同明细.xls")
    Dim fl As String = ProjectPath & "Reports\\QD" & Format(Date.Today,"yyyyMMdd") & ".xls"
    Dim Sheet As XLS.Sheet = Book.Sheets(0)
    Sheet(4,14).Value = "B" & Format(Date.Today, "yyMMdd") \'写入合同编号
    Book.Build() \'生成细节区
    Book.Save(fl) \'保存工作簿
    Dim Proc As New Process \'打开工作簿
    Proc.File = fl
    Proc.Start()
   
End If

 


--  作者:Bin
--  发布时间:2015/3/31 17:00:00
--  
在菜单Click写.
你是根据某个表当前行来判断?

dim dr as datarow = tables("X").current.datarow