Foxtable(狐表)用户栏目专家坐堂 → 打印报错


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

主题:打印报错

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


加好友 发短信
等级:超级版主 帖子:107440 积分:546479 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2018/6/4 21:03:00 [显示全部帖子]

Dim rs As List(of Row) = t.GetCheckedRows
If rs.Count > 0 Then '如果存在符合条件的行
    Dim tm As String  = ProjectPath & "Attachments\报告.doc" '指定模板文件
    Dim fl As String = ProjectPath & "Reports\报告.doc"
    Dim wrt As New WordReport(Tables("报告_Table1"),tm,fl) '定义一个WordReport
    For Each r As Row In rs '逐行生成报表
        wrt.BuildOne(r)
        wrt.RecordsOnEachPage = 1
    Next
    wrt.Quit
    'wrt.Show() '显示报表
    Dim app As New MSWord.Application
    try
        Dim doc = app.Documents.Open(fl)
        Doc.PrintPreview
        app.Visible = True
        Doc.PrintOut '打印
    catch ex As exception
        msgbox(ex.message)
    finally
        app.Quit
    End try
Else
    MessageBox.show("请先勾选要打印的报告!")
End If

 回到顶部