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

C#封装Word常用操作类

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

补充:软件开发 , C# ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,