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

C#操纵word2007的怪问题
最近写一个使用C#操纵word的代码,要求使用word中的查找和替换功能,源码如下:    
 
 
              class     WdDocument     :     Microsoft.Office.Interop.Word.ApplicationClass    
              {    
                              object     oSpath;    
                              object     oTpath;    
                              object     missing     =     Missing.Value;    
                              public     WdDocument(string     spath,string     opath)    
                              {    
                                              this.oSpath     =     spath;    
                                              this.oTpath     =     opath;    
 
                              }    
 
                              public     void     replacement(string     replace,     string     value)    
                              {    
                                              object     rWords     =     replace;    
                                              object     vWords     =     value;    
                                              object     repType     =     WdReplace.wdReplaceAll;    
                                              Document     myDoc     =     this.Documents.Open(ref     this.oSpath,     ref     missing,     ref     missing,     ref     missing,    
                                                                &nbs