1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using Microsoft.Office.Interop.Word;
5 using System.Diagnostics;
6 namespace OfficeManager
7 {
8 public class WordClass : IDisposable
9 {
10 #region 字段
11 private _Application m_WordApp = null;
12 private _Document m_Document = null;
13 private object missing = System.Reflection.Missing.Value;
14 #endregion
15 #region 構造函數與析構函數
16 public WordClass()
17 {
18 m_WordApp = new ApplicationClass();
19 }
20 ~WordClass()
21 {
22 try
23 {
24 if (m_WordApp != null)
25 m_WordApp.Quit(ref missing, ref missing, ref missing);
26 }
27 catch (Exception ex)
28 {
29 Debug.Write(ex.ToString());
30 }
31 }
32 #endregion
33 #region 屬性
34 public