.net实现word里面插入图片
using Word=Microsoft.Office.Interop.Word; //先要引入office安装下的msword.olb文件
方法是:
  protected void Button1_Click(object sender, EventArgs e)
    {
        OutPut();
    }
     private void OutPut()
    {
               
         object oMissing = System.Reflection.Missing.Value; 
object Range=System.Reflection.Missing.Value; 
        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("http://www.gzpxmtj.gov.cn:8001/SafetyNet/WebCharts/0c81faaa-8141-44f6-9497-e5cf2bd7cbdb.Png", ref oMissing, ref oMissing, ref Range);
public void xiazai()//写入流下载word
{
       Response.Clear();
        Response.Buffer = true;
        Response.Charset = "GB2312";
        Response.AppendHeader("Content-Disposition", "attachment;filename=out.doc");
        Response.ContentType = "application/ms-word";
        this.EnableViewState = false;
        System.IO.StringWriter swOut = new System.IO.StringWriter();
        System.IO.BinaryWriter ss=new System.IO.BinaryWriter(
        HtmlTextWriter hTw = new HtmlTextWriter(swOut);
htw.write("张恩亮");
        
           
       Response.Write(swOut.ToString());
       Response.End();
    }
 
                     
                    
                 
                    
                 
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号