Foxtable(狐表)用户栏目专家坐堂 → 选择模板


  共有2792人关注过本帖树形打印复制链接

主题:选择模板

美女呀,离线,留言给我吧!
信达
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:183 积分:1320 威望:0 精华:0 注册:2014/11/22 18:33:00
选择模板  发帖心情 Post By: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


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By: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
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:35433 积分:178524 威望:0 精华:3 注册:2013/3/30 16:36:00
  发帖心情 Post By:2015/3/31 17:00:00 [只看该作者]

在菜单Click写.
你是根据某个表当前行来判断?

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

 回到顶部