Foxtable(狐表)用户栏目专家坐堂 → [求助]清除文本空行、断行


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

主题:[求助]清除文本空行、断行

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


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

'''
Dim app As New MSWord.Application
try

    Dim doc = app.Documents.Open("D:\问题\测试文本整理\测试.doc")
    Dim str As String
    Dim count = Doc.Characters.Count
    Dim rng As MSWord.Range = Doc.Range(Start:=0, End:=count)
    str  = rng.text
    str  = str.replace("。" & chr(13),"。" & vbcrlf)
    str  = str.replace(chr(13),"")
    Output.Show(str )
    app.Quit
    
catch ex As exception
    msgbox(ex.message)
    app.Quit
End try

 回到顶部