Foxtable(狐表)用户栏目专家坐堂 → [求助]外部引用msword问题


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

主题:[求助]外部引用msword问题

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


加好友 发短信
等级:童狐 帖子:235 积分:2346 威望:0 精华:0 注册:2011/6/19 0:05:00
[求助]外部引用msword问题  发帖心情 Post By:2018/11/28 22:48:00 [只看该作者]

1、批量设置图片大小,红色部分出错,请问如何处理。
2、代码
Dim app As New MSWord.Application
try

Dim fileName = "E:\test.docx"
Dim doc As object = app.Documents.Open(fileName)

Dim ishape As msword.InlineShape
For Each ishape In app.ActiveDocument.InlineShapes
' ishape.LockAspectRatio = msoCTrue
' If ishape.Type = msword.wdInlineShapePicture Then

If ishape.height > 400

ishape.height = 450

Else


If ishape.Width > 250 Then

ishape.Width = 480
Else
ishape.Width = 238
End If
End If
' End If
Next
MsgBox("done")


app.visible = True
catch ex As exception
msgbox(ex.message)
app.Quit
finally

End try


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


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

参考

 

Dim app As New MSWord.Application
try
    Dim doc = app.Documents.Open("d:\test.doc")
    For Each shape As object In doc.InlineShapes
        If shape.Type = MSWord.WdInlineShapeType.wdInlineShapePicture

            system.threading.thread.sleep(50)
            shape.ConvertToShape
        End If
    Next
    doc.saved = True
    app.visible = True
catch ex As exception
    msgbox(ex.message)
    app.Quit
finally
   
End try


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


加好友 发短信
等级:童狐 帖子:235 积分:2346 威望:0 精华:0 注册:2011/6/19 0:05:00
  发帖心情 Post By:2018/12/15 16:35:00 [只看该作者]

谢谢

 回到顶部