如题

解决方案 »

  1.   

    在word相应的位置插入书签,C#中添加word的引用,然后操作word,把数据放到word书签位置。
    就记得这么多,详细的网上搜搜
      

  2.   

    我来给楼上做下补充  嘿嘿 
    using Microsoft.Office.Interop.Word;然后在具体需要操作的地方Microsoft.Office.Interop.Word.ApplicationClass wordapp = new Microsoft.Office.Interop.Word.ApplicationClass();
    Microsoft.Office.Interop.Word.Document doc = null;object nothing = System.Reflection.Missing.Value;
    object filePath1 = modelPath; //模板的地址
                    doc1 = wordapp1.Documents.Open(ref filePath, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing); string bmn="book";//书签的名字doc.Books.get_Item(ref bmn).Range.Text=“你需要插入的内容”;object filePath2="你需要将此word保存的地址";
    doc.SaveAs(ref filePath2, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing);doc.Close(ref save, ref nothing, ref nothing);//关闭word
    wordapp.Quit(ref nothing, ref nothing, ref nothing);
      

  3.   

    http://blog.csdn.net/huyang77/article/details/7789987去看看希望对你有帮助
      

  4.   

    嗯 我觉得我的例子很全了啊 从打开ApplicationClass,到关闭它。
    设计word操作,如果仅仅是想book中插入东西的话,这点应该就很全了啊
      

  5.   

    我想说的,首先不推荐服务器端或程序中调用com来弄word,太容易假退出了,目前我的应用专门写了个杀word进程的小程序,来干掉服务器上超过一分钟还不退出的word.exe。其它的4楼的例子非常好,我就不多说了,要注意的是office2000,2003,2007,2010的调用接口函数的参数表都各有不同。                doc1 = wordapp1.Documents.Open(ref filePath, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing); 这个里面很可能多几项,少几项的,要注意自己服务器上的版本后上网查相关的介绍,或者自己在自己服务器上的word的vba中查看帮助,帮助中会说明当前版本的vba参数表的。
      

  6.   


    我知道这个是主要的代码,但不全,我想要个全的object filePath1 = modelPath; //模板的地址
                    doc1 = wordapp1.Documents.Open(ref filePath, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing); doc1是从哪来的