Foxtable(狐表)用户栏目专家坐堂 → [求助]在窗口中预览word报表时存在的问题


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

主题:[求助]在窗口中预览word报表时存在的问题

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


加好友 发短信
等级:超级版主 帖子:110574 积分:562760 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/10/6 8:59:00 [显示全部帖子]

同样的问题你已经问过了
http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=89554
http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&Id=89633


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


加好友 发短信
等级:超级版主 帖子:110574 积分:562760 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/10/7 8:46:00 [显示全部帖子]

Dim wbr As WinForm.WebBrowser = e.Form.Controls("WebBrowser1")
Dim tm As String  = ProjectPath & "Attachments\11(不含表格).doc"
Dim fl As String = ProjectPath & "Reports\11(不含表格)doc"
Dim wrt As New WordReport(Tables("表AA"),tm,fl)
wrt.Build()
wrt.Quit()

Dim app As New MSWord.Application
try
    Dim doc = app.Documents.Open(fl)
    doc.Content.Find.Execute(FindText:="^l", replacewith:="^p", Replace:=2)
    doc.Content.Find.Execute(FindText:="^13", replacewith:="^p", Replace:=2)
    
    For Each k As object In doc.Paragraphs
        k.Range.Select
        If Len(k.Range.text) = 1 Then k.Range.Delete
        Do
            If app.Selection.Characters(1).Text = Chr(10) Then app.Selection.Characters(1).Delete
        Loop Until app.Selection.Characters(1).Text <> Chr(10)
    Next
    
    '删除表格空行:
    Dim tb As Object, r As Object
    With Doc
        For Each tb In .Tables
            For Each r In tb.Rows
                r.Range.Find.Execute(FindText:="^l", replacewith:="^p", Replace:=2)
                r.Range.Find.Execute(FindText:=" ", replacewith:="", Replace:=2)
                r.Range.Find.Execute(FindText:="^w", replacewith:="", Replace:=2)
                If Len(Replace(Replace(r.Range.Text, vbCr, ""), Chr(7), "")) = 0 Then r.Delete
            Next
        Next
    End With    
    doc.save
    app.quit
catch ex As exception
    msgbox(ex.message)
    app.quit
End try

wbr.Address = fl

 回到顶部