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


C#操作Word对象:
指定位置  :  设置书签。
主要代码:

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;

转载于:https://www.cnblogs.com/candywyq/archive/2007/07/04/805005.html

你可能感兴趣的:(操作Word对象----在指定位置插入图片并设置大小(原))