日期:2014-05-19  浏览次数:21255 次

com.jacob.com.ComFailException: Can't map name to dispid: Close
用jacob操作word文档,出现如下问题:
1.在写入word文档的时候,总是提示出现副本,必须要修改名字,写入副本才可以
2.我在关闭的时候,报错信息如下:
com.jacob.com.ComFailException: Can't map name to dispid: Close
Java code

Document doc = null; 
        try { 
            addList();
          doc = new Document();
          doc.open(newPath);//打开文件 
          doc.insertAtBookmark("userName",ujl.getjlName()); 
          doc.insertAtBookmark("describe",ujl.getdescirbe()); 
          doc.insertAtBookmark("eMail",ujl.getjlMail()); 
          doc.insertAtBookmark("english",(String)mapEnglish.get(ujl.getenglish())); 
          doc.insertAtBookmark("jianliStatus",(String)mapJlStatue.get(ujl.getjlStatue())); 
          doc.insertAtBookmark("juZhuDi",(String)mapAddress.get(ujl.getresidonce())); 
          doc.insertAtBookmark("renYuanStatus",(String)mapJlType.get(ujl.getjlType())); 
          doc.insertAtBookmark("sex",(String)mapSex.get(ujl.getsex())); 
          doc.insertAtBookmark("telPhone",ujl.getjlPhone()); 
          doc.insertAtBookmark("workTime",(String)mapworkTime.get(ujl.getworkTime())); 
          doc.insertAtBookmark("xueLi",(String)mapXueLi.get(ujl.getxueLi())); 
          doc.insertAtBookmark("zhiWei",(String)mapCateType.get(ujl.getcateType())); 
          //判断行业经验
          String level = "";
          if(ujl.getjlLevel() != null && ujl.getjlLevel().length() > 0){
              String levels[] = ujl.getjlLevel().split(";");
              for (int i = 0; i < levels.length; i++) {
                  level = (String)mapJlLevel.get(levels[i])+"\n";
            }
          }
          doc.insertAtBookmark("HangyeJingyan",level); 
          //判断技术特长,对应关键字
          String keyWord = "";
          if(ujl.getkeyword() != null && ujl.getkeyword().length() > 0){
              String keyWords[] = ujl.getkeyword().split(" ");
              for (int i = 0; i < keyWords.length; i++) {
                  keyWord = (String)mapJlLevel.get(keyWords[i])+"\n";
            }
          }
          doc.insertAtBookmark("KeyWord",keyWord);
          //判断擅长语言,对应擅长技术
          String jishu = "";
          if(ujl.gettechnology() != null && ujl.gettechnology().length() > 0){
             String jishus[] = ujl.gettechnology().split(";");
             for (int i = 0; i < jishus.length; i++) {
                 jishu = (String)mapTechnology.get(jishus[i])+"\n";
             }
          }
          doc.insertAtBookmark("shanChangJishu",jishu); 
        } 
        catch (Exception e) { 
            //log.debug("复制模板的时候出错!");
            //throw new ServiceException("在生成标准模板简历的时候发生错误!"); 
            e.printStackTrace();
        } finally { 
          try { 
            if(doc!=null){
               Thread.interrupted();
               doc.close(true); 
            } 
          } catch (Exception e) { 
            //  log.debug("复制模板的时候出错!");
              //throw new ServiceException("在生成标准模板简历的时候发生错误!"); 
                e.printStackTrace();
          } 

        } 




------解决方案--------------------
路过、帮顶...
------解决方案--------------------
这方面没有做过Y,帮顶啦~~~~~~~
------解决方案--------------------
http://www.blogjava.net/lusm/archive/2007/03/27/106737.html
这方面做的少,不过楼主可以去网上看看,在细心的调试一下,应该能解决的。
http://www.google.com.hk/search?hl=zh-CN&lr=lang_zh-CN&newwindow=1&safe=strict&tbs=lr%3Alang_1zh-CN&q=com.jacob.com.ComFailException%3A+Can%27t+map+name+to+d