以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]有没有办法将Word文档保存为图片?  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=136341)

--  作者:rainbow_59
--  发布时间:2019/6/11 16:11:00
--  [求助]有没有办法将Word文档保存为图片?
求教:有没有办法将Word文档保存为图片?
--  作者:有点甜
--  发布时间:2019/6/11 16:40:00
--  

参考

 

http://foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=135037&skin=0

 


--  作者:rainbow_59
--  发布时间:2019/6/27 15:31:00
--  
谢谢有点甜老师的指导。已经成功将Word文档保存问图片,但打开图片后只有首页。如果文档有N业,如何将所有页面都保存为图片,或者将指定页,例如最后一页保存为图片?再次感谢!
--  作者:有点甜
--  发布时间:2019/6/27 17:10:00
--  

参考

 

Dim app As New MSWord.Application
try
    Dim doc = app.Documents.Open("d:\\test.doc")
    Dim allpage = doc.ComputeStatistics(msWord.WdStatistic.wdStatisticPages)
    For objPage As Integer = 1 To allpage
        Dim objWhat = msWord.WdGoToItem.wdGoToPage
        Dim objWhich = MsWord.WdGoToDirection.wdGoToAbsolute
        Dim range1 = Doc.GoTo(objWhat, objWhich, objPage)
        Dim range2 = range1.GoToNext(MsWord.WdGoToItem.wdGoToPage)
        Dim bjStart = range1.Start
        Dim objEnd = range2.Start
        If range1.Start = range2.Start Then objEnd = Doc.Characters.Count
        \'msgbox(objpage)
        Doc.Range(bjStart, objEnd).Select
       
        app.ActiveWindow.Selection.copy
        app.ActiveWindow.Selection.PasteSpecial(Link:=False, DataType:=9, _
        Placement:=0, DisplayAsIcon:=False)
    Next
Dim i As Integer = 1
    For Each shape As object In doc.InlineShapes
        shape.Range.copy
        If ClipBoard.GetImage IsNot Nothing Then
            ClipBoard.GetImage.save("d:\\abc" & i & ".jpg")
        End If
        i += 1
    Next
    Doc.saved = True
    \'app.visible = True
   
   
    app.visible = True
catch ex As exception
    msgbox(ex.message)
    app.Quit
finally
    \'app.Quit
End try