图文混排,下面两种形式,图片居中就好,并且如果size超过A4页面的话自动缩小为合适尺寸1)图文均换行
文字
图片
文字
图片
文字2)图文均不换行
文字 图片 文字 图片 文字

解决方案 »

  1.   

    函数:oWord.Selection.InlineShapes.AddPicture(ref name,ref LinkToFile,ref SaveWithDocument,ref Range);示例:object oMissing = System.Reflection.Missing.Value; 
    object oEndOfDoc = "\\endofdoc"; /* \endofdoc is a predefined book */ 
    object name= "d:\\myfile.doc"; 
    object Range=System.Reflection.Missing.Value; //Start Word and create a new document. 
    Word.Application oWord; 
    Word.Document oDoc; 
    oWord = new Word.ApplicationClass(); 
    oWord.Visible = true; 
    oDoc = oWord.Documents.Add(ref oMissing, ref oMissing,ref oMissing, ref oMissing); 
    oWord.Selection.Font.Bold = 1; 
    oWord.Selection.Font.Size=18; 
    oWord.Selection.ParagraphFormat.Alignment =Word.WdParagraphAlignment.wdAlignParagraphCenter; 
    oWord.Selection.InlineShapes.AddPicture("e:/picture/123.jpg",ref oMissing,ref oMissing,ref Range);http://topic.csdn.net/t/20060408/12/4672092.html
      

  2.   


    谢谢,插入图片我是会做的。无法解决的问题是图文混排
    public void InsertImage2(string imageFile)
    {
    object Range = System.Reflection.Missing.Value; wdDoc.Paragraphs.Last.Range.Text = "text1";
    wdDoc.Paragraphs.Add(ref Nothing);
    wdDoc.Paragraphs.Last.Range.Text = "text2"; //Start Word and create a new document. 
    wdApp.Selection.Font.Bold = 1;
    wdApp.Selection.Font.Size = 18;
    wdApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter;
    wdApp.Selection.InlineShapes.AddPicture(imageFile , ref Nothing , ref Nothing , ref Range); }
    以上代码我预期的效果是:text1
    text2
    图片结果输出以后变成图片
    text1
    text2即图片定位问题,求教
      

  3.   

    word 中有个方法,就是先将要编辑的内容设置成一个网页(html)形式,,这个你可以控制吧
    然后word类中有提供个方法,好像是什么 insertXXXX的把这个网页直接插入进去,以前我做类似的事情,中有想过很好
      

  4.   

    分段换行混排已经实现了,想知道不换行图文混排怎么做 object Range = System.Reflection.Missing.Value; wdDoc.Paragraphs.Last.Range.Text = "text1";
    wdDoc.Paragraphs.Add(ref Nothing);
    wdDoc.Paragraphs.Last.Range.Text = "text2"; //插入图片要用到Selection对象,所以应新建一个段落,然后在插入段落处调用Select()函数
    wdDoc.Paragraphs.Add(ref Nothing);
    wdDoc.Paragraphs.Last.Range.Select(); //Start Word and create a new document. 
    wdApp.Selection.Font.Bold = 1;
    wdApp.Selection.Font.Size = 18;
    wdApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter;
    wdApp.Selection.InlineShapes.AddPicture(imageFile , ref Nothing , ref Nothing , ref Range);