求助:C#中使用Word.application 控件,向Word文档中插入图片请赐教!

解决方案 »

  1.   

    有个AddPicture的函数
    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:/wzxsjs/picture/xczp/2005/02/K330206980000200501000201.jpg",ref oMissing,ref oMissing,ref Range);