本人在作项目的时候要用到word控制功能,
关于表格的控制已经基本完成!就是在表格单元中画对角线不知道怎么作??
还有就是关于域的控制,我参照了一些网上的代码,可是在我的环境中确不能实现.特别是在域的设置和填植的时候
我域 的设置方法如下:
(1)在插入主菜单中选择域。
(2)选择 “文档自动化”类别。
(3)从域名中选择“DocVariable”。
设置的时候用的方法是:
//wApp是wordapplications 对象
//也尝试过用worddocument对象
 if(wApp.ActiveDocument.Books.Exists("C") == true)
   {
    wApp.ActiveDocument.Books.get_Item
     (ref bkmC).Select();
   }可是不知道为什么我的代码运行的时候加载模板都很正常,可是在找域的时候wApp.ActiveDocument不存在.
用worddocument对象的时候提示对象的Books属性不存在,
我用的开发环境是 vs2003 net office也是2003版的希望大虾们提供高见!
如果有word的dll的文挡希望提供:[email protected]
(急!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!)

解决方案 »

  1.   

    wordapp对象和worddoc对象都要有的
     
    object oMissing = System.Reflection.Missing.Value;
          object fileName = "doc路径";
          Word._Application WordApp = new Word.ApplicationClass();
          Word._Document WordDoc = null;
          WordDoc = WordApp.Documents.Open(ref fileName,
                    ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                    ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                    ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);//开文件