[.NET C# - Word] 關閉 Word 檔

摘要:[.NET C# - Word]關閉Word

 

01 using Microsoft.Office.Interop.Word;  
02   
03 public class WordHelper  
04 {  
05     private _Document m_Document = null;  
06     private _Application m_wordApplication = null;  
07   
08     public void CloseWordDocument()  
09     {  
10         object oSaveChanges = WdSaveOptions.wdSaveChanges;
11         this.m_Document.Close(ref oSaveChanges, ref oMissing, ref oMissing);
12         this.m_wordApplication.Quit(ref oSaveChanges, ref oMissing, ref oMissing);
13     }
  
14 }