Foxtable(狐表)用户栏目专家坐堂 → 按钮代码问题求助


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

主题:按钮代码问题求助

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/12/3 16:16:00 [只看该作者]


Dim tb As WinForm.TabControl = e.Form.Controls("TabControl1")
Dim pg As WinForm.TabPage = tb.SelectedPage
Dim doc As PrintDoc = e.Form.GernatePrintDoc(pg)
If tb.SelectedPage.Text = "page2" Then
    Dim dlg As New OpenFileDialog '定义一个新的OpenFileDialog
    dlg.Filter= "Excel文件|*.xls|Word文件|*.doc|Access文件|*.mdb" '设置筛选器
    If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
        Dim idx As Integer = dlg.FileName.LastIndexOf(".")
        Dim ext As String  = dlg.FileName.SubString(idx).Toupper
        If ext.contains(".XLS") Then
            Dim Book As New XLS.Book(dlg.FileName)
            Dim fl As String = ProjectPath & "Reports\考核.xls"
            Book.Build()
            Book.Save(fl)
            Dim App As New MSExcel.Application
            Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(fl)
            Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
            App.Visible = True
            ShowAppWindow("考核",2)
            Ws.PrintPreview
            App.Quit
        ElseIf ext.contains(".DOC") Then '如果用户单击了确定按钮
            Dim tm As String  = dlg.FileName
            Dim fl1 As String = "D:\准考证\准考证.doc" '指定目标文件
            Dim fl2 As String = "D:\准考证\准考证.pdf" '指定目标PDF文件
            Dim wrt As New WordReport(Tables("管理_Table8"),tm,fl1) '定义一个WordReport
            wrt.Build() '逐行生成报表
            wrt.SaveToPDF(fl2) '保存为PDF文件
            wrt.Quit() '退出
            Dim Proc As New Process '打开PDF文件
            Proc.File = fl2
            Proc.Start()
        End If
    End If
End If

 回到顶部
总数 11 上一页 1 2