如何在PowerPoint中替换图片形状的图像? [英] How to replace image of a picture shape in PowerPoint?

查看:840
本文介绍了如何在PowerPoint中替换图片形状的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过代码替换PowerPoint中现有图片形状的图像?

Is there any way to replace the image of an existing picture shape in PowerPoint from code?

谢谢

推荐答案

如果它是链接图像,请用新文件覆盖链接图像文件,或将链接指向新文件.

If it's a linked image, either overwrite the linked image file with a new file or point the link at a new file.

或者,如果形状是图片填充的,则可以用其他图片填充它.如果图片的比例与形状的比例不匹配,则可能会使图片失真.相反,您可以根据需要更改形状的长宽比以匹配图片的长宽比.

Or if the shape is picture filled, you can fill it with a different picture instead. That can distort the picture if its proportions don't match the shape's proportions; instead, you can change the aspect ratio of the shape to match that of the picture if need be.

要更改图片填充,请在osh中引用形状:

To change the picture fill, assuming a reference to the shape in osh:

With osh.Fill
    .UserPicture ("C:\path\to\picture.jpg")
End With

要计算图片的大小,以便可以调整其形状,可以使用外部图像处理软件,也可以将图片插入PPT,将高度和宽度参数设置为-1,然后选择.Height和.新插入图片的宽度,然后将其删除.

To work out the size of the picture so you can adjust the shape to it, you can either use external image processing software or insert the picture into PPT, giving -1 for height and width parameters and pick up the .Height and .Width of the newly inserted picture, then delete it.

或插入新图片,拾取旧图片的大小/位置/其他属性,然后将其应用于新图片,删除旧图片,将新图片移到旧图片的Z轴上.

Or insert a new picture, pick up the old picture's size/position/other proprties and apply them to the new picture, delete the old picture, move the new one to the old one's Z-order.

这篇关于如何在PowerPoint中替换图片形状的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆