如何在将图片插入word文档后更改图片的大小 [英] How to change the size of a picture after inserting it into a word document

查看:245
本文介绍了如何在将图片插入word文档后更改图片的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将图片添加到某个书签的word文档中。但是,图片太大并且正在强制文本离开页面,因此我需要能够在单词文档中更改图片的大小。

I'm adding a picture to a word document at a certain bookmark. However, the picture is too big and is forcing text off the page, so I need to be able to change the size of the picture after it is in the word document.

推荐答案

当您插入图像时,它应该返回一个InlineShape,您可以修改它:

When you insert the image, it should return you an InlineShape, which you can modify:

Word.Application app = new Word.Application();
var doc = app.Documents.Open(@"C:\Users\SomeUserName\Desktop\Doc1.docx");

var shape = doc.Bookmarks["PicHere"].Range.InlineShapes.AddPicture(@"C:\Users\SomePicture\Pictures\1234.JPG", false, true);
shape.Width = 150;
shape.Height = 150;
app.Visible = true;

这篇关于如何在将图片插入word文档后更改图片的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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