本文介绍了将图片插入word文档后如何更改图片大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在将图片添加到某个书签处的 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:UsersSomeUserNameDesktopDoc1.docx");
var shape = doc.Bookmarks["PicHere"].Range.InlineShapes.AddPicture(@"C:UsersSomePicturePictures1234.JPG", false, true);
shape.Width = 150;
shape.Height = 150;
app.Visible = true;
这篇关于将图片插入word文档后如何更改图片大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!