当前位置:软件学习 > Word >>

C#访问共享目录与Word.ApplicationClass发生冲突的解决办法

[csharp]  #region 创建临时Temp文件方法 StartFileBuffer  
  /// <summary>  
  /// 创建临时Temp文件方法  
  /// </summary>  
  /// <param name="fileName"></param>  
  private void StartFileBuffer(object fileName) 
  { 
      string physicsFilePath = fileName.ToString(); 
      string physicsFilePathTemp = string.Empty; 
      if (physicsFilePath.IndexOf(".doc") > 0) 
      { 
          physicsFilePathTemp = physicsFilePath.Replace(".doc", "Temp.doc"); 
      } 
      else if (physicsFilePath.IndexOf(".docx") > 0) 
      { 
          physicsFilePathTemp = physicsFilePath.Replace(".docx", "Temp.docx"); 
      } 
      try 
      { 
 
          string targetIP = string.Empty; 
          string targetLoginName = string.Empty;             
          string targetPassword = string.Empty;  
          using (IdentityScope iss = new IdentityScope(targetLoginName, targetIP, targetPassword)) 
          { 
              //string path = @"\\" + easyWorkCfgString.targetIP + @"\" + easyWorkCfgString.baseFloder;  
              if (File.Exists(fileName.ToString())) 
              {      
                //自己的代码处理逻辑                                        

          } 
      } 
      catch (Exception e) 
      { 
          throw new Exception("创建临时文件Temp出错,StartFileBuffer Exception:" + e.Message); 
      } 
  } 
  #endregion 
补充:软件开发 , C# ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,