利用  Microsoft.Office.Interop.Word
怎样实现VS对Word的图文混排一下代码为什么不能控制图片插到文字中间
object missing = Type.Missing;
            object iStart = 0;
            object iEnd = 1;
            Microsoft.Office.Interop.Word.Application app1 = new Microsoft.Office.Interop.Word.Application();
            app1.Visible = true;
            Microsoft.Office.Interop.Word.Document doc1 = app1.Documents.Add(ref missing, ref missing, ref missing, ref missing);
            Microsoft.Office.Interop.Word.Range rng1 = doc1.Range(ref iStart, ref iEnd);
           
            rng1.Text += "文字\n"; 
            rng1.Text += "钟1\n";
            doc1.InlineShapes.AddPicture("C:\\b.JPG", ref missing, ref missing, ref missing);懂VSTO的帮帮小弟指点一下呀,留qq更好……

解决方案 »

  1.   

    rng1.Collapse(ref WdCollapseDirection.End);
    rng1.InsertParaphAfter();
    rng1.Collapse(ref WdCollapseDirection.End);object range = rng1;
    doc1.InlineShapes.AddPicture("c:\\b.JPG", ref range.......);range的位置记不清啦,现在没有环境,你自己看看吧
      

  2.   

    wowoj2ee
    可以解释一下你的代码吗?rng1.Collapse(ref WdCollapseDirection.End); 
    rng1.InsertParaphAfter(); 
    谢谢,又是你帮我回答了~~
      

  3.   

    //rng1的范围移到文本之后
    rng1.Collapse(ref WdCollapseDirection.End);  == rng1.SetRange(rng1.End, rng1.End);
    //插入换行也就是新段落
    rng1.InsertParaphAfter(); 
      

  4.   

    wowoj2ee 教下俺了,我q是7823806 加我……
      

  5.   

    UP~~~这问题解决不了 我就一直UP
      

  6.   

    up!寻找wowoj2ee~~
    寻找有心人……教教小弟……
      

  7.   

    【VSTO之家】
    http://vsto.5d6d.com【VSTO专家群】109033523借VS2010东风,CSDN为啥不搞一个VSTO版快!!!!
    【VSTO】数据获取
    【VSTO】对象起源
    【VSTO】MSDN
    【VSTO】Backstage View
    【VSTO】名人堂
    【VSTO】案例
    【VSTO】MOSS
    【VSTO】Excel Services
    【VSTO】Open XML
    【VSTO】资源、工具
    【VSTO】教学视频
    【VSTO】示例代码 
    【VSTO】Actions Pane
    【VSTO】智能标签 ...