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

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;


你可能感兴趣的:(C#,WinForm,C#提高,Word,bookmarks,文档,c)