告诉个不用控件的办法,关于使用office组件随便到本论坛搜索就可以找的到,所以我用一个比较另类的办法,首先在页面提交的时候把TXT通过流保存到文件,但文件的扩展名使用.DOC,这样WORD可以自动转化.另:关于webform使用office组件,建议使用webservice防止没有权限问题.

解决方案 »

  1.   

    怎样做啊:
    Object Nothing=System.Reflection.Missing.Value;
    object filename = "D:\\"+wordname + ".DOC";
    Word.Application WordApp=new Word.ApplicationClass();
    Word.Document WordDoc=WordApp.Documents.Add(ref Nothing,ref Nothing,ref Nothing,ref Nothing);
    Word.Table table=WordDoc.Tables.Add(WordApp.Selection.Range,1,1,ref Nothing,ref Nothing);
                table.Cell(1,1).Range.Text=wordname;
    WordDoc.Paragraphs.Last.Range.Text=wordText;
    WordDoc.SaveAs(ref filename,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing);
    WordDoc.Close(ref Nothing, ref Nothing, ref Nothing);
                WordApp.Quit(ref Nothing, ref Nothing, ref Nothing);
    说宏出错误啊