您的位置:首页 > 其它

操作Word对象----在指定位置插入图片并设置大小

2012-03-30 16:25 447 查看
http://www.cnblogs.com/cryf/articles/904004.html

Word.Application oWord;

Word.Document oDoc;

object name= "d:\\myfile.doc";

object Range=System.Reflection.Missing.Value;

object bookmarks="C2";

oWord = new Word.ApplicationClass();

oWord.Visible = true;

//打开文档

oDoc = oWord.Documents.Open(ref name, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);

oDoc.Bookmarks.get_Item(ref bookmarks).Select();

//插入图片 并设置图片大小

InlineShape il=oWord.Selection.InlineShapes.AddPicture("c:\\wjjpg.jpg", ref oMissing, ref oMissing, ref Range);

il.Width = 40;

il.Height = 50;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: