最近在程序中发现这样一来一个问题:
程序简要写一下:    public static TDocument RefDoc = null;//new CWord();
    public static Dictionary<string, TDocument> RefDocs = null; for (int i = 0; i < ReferenceArray.Length; i++)
{
 Program.RefDoc = new WordDocument(DocType.Reference);
 Program.RefDoc.Open(ReferenceArray[i]);    // used to open a word
 ......
 Program.RefDocs.Add(FileName, Program.RefDoc); //store every word instance
}问题出现在:
当我循环关闭Program.RefDocs 中的各个RefDoc 的时候 
foreach(KeyValuePair<string,TDocument> tempItem in Program.RefDocs)
 {
              tempItem.value.close();
}可以执行到close,但是任务管理器中还会有word 的进程,一直都没有搞清楚,希望搞人指教一下,谢谢!

解决方案 »

  1.   

    最后加上
    foreach(KeyValuePair <string,TDocument> tempItem in Program.RefDocs)
    {
                  tempItem.value.close();
    }
    Program.Refdocs.Clear();
    Program.RefDoc = null;全部引用都要清空。
      

  2.   

    我的观点也是这样:
    foreach(KeyValuePair <string,TDocument> tempItem in Program.RefDocs)
    {
                  tempItem.value.close();
    }
    Program.Refdocs.Clear();
    Program.RefDoc = null;
      

  3.   

    事实证明word进程有时就是无法结束!