object NameBookMark = "pzr";
  object rng = winWordControl1.document.Books.Item(ref NameBookMark).Range;
  Word.InlineShape il;  
  il=winWordControl1.document.InlineShapes.AddPicture("1.bmp", ref Linktofile, ref savewithdocument, ref rng);
  il.Width = 60;
  il.Height = 30;
如何对插入的图片设置为衬于文字下方

解决方案 »

  1.   

    先转成Shape,再调用ZOrder方法设置就OK啦
    il.ConvertToShape().ZOrder(Microsoft.Office.Core.MsoZOrderCmd.msoSendBehindText);
      

  2.   


      string spr = dt.Rows[0]["CONFIRM_EMP_NAME"].ToString();
                        string shr = dt.Rows[0]["AUDIT_EMP_NAME"].ToString();                    string PicturePath;
                        PicturePath = SystemInfo.RunPath + "BMP\\";
                        object Linktofile = false;
                        object savewithdocument = true;                    object NameBookMark = "spr";
                        object rng = winWordControl1.document.Books.Item(ref NameBookMark).Range;
                        if (File.Exists(PicturePath + spr + ".bmp"))
                        {
                            Word.InlineShape il;
                            il = winWordControl1.document.InlineShapes.AddPicture(PicturePath + spr + ".bmp", ref Linktofile, ref savewithdocument, ref rng);
                            il.Width = 30;
                            il.Height = 25;
                            il.ConvertToShape().ZOrder(Office.MsoZOrderCmd.msoBringInFrontOfText);
                        }                    object NameBookMark1 = "shr";
                        object rng1 = winWordControl1.document.Books.Item(ref NameBookMark1).Range;
                        if (File.Exists(PicturePath + shr + ".bmp"))
                        {
                            Word.InlineShape il1;
                            il1 = winWordControl1.document.InlineShapes.AddPicture(PicturePath + shr + ".bmp", ref Linktofile, ref savewithdocument, ref rng1);
                            il1.Width = 30;
                            il1.Height = 25;
                            il1.ConvertToShape().ZOrder(Office.MsoZOrderCmd.msoBringInFrontOfText);
                        }shr这个书签的图片没有msoSendBehindText效果
    spr这个书签的图片有这个效果,为什么
      

  3.   

    spr这个书签的图片的位置还往上移动了
      

  4.   

    我觉得可能是书签的问题,第一个书签插入图片成功后,影响了第二个书签的位置,你调试时,对比一下两个书签插入图片前后的Start与End属性看看。 
      

  5.   

    用這個控件來幫助你:
    http://www.textcontrol.com/en_US/
      

  6.   

    我說的控件能支持word文檔建立和編輯
      

  7.   

    我不确定下面这代码对你有没有用, 你可以试试Shape ilShape = il.ConvertToShape();
                ilShape.Select();
                ilShape.WrapFormat.Type= WdWrapType.wdWrapNone;
                ilShape.ZOrder(Microsoft.Office.Core.MsoZOrderCmd.msoSendBehindText); 
      

  8.   

    word里直接插入图片,对插入的图片设置为衬于文字下方,直接双击图片有属性就可以设置啦