zoukankan      html  css  js  c++  java
  • 获取office版本

       /// <summary>
            /// office版本
            /// </summary>
            public enum OfficeVersion { Office2007,Office2003}    

      /// <summary>
            /// 获取office版本
            /// </summary>
            /// <returns></returns>
            public static OfficeVersion GetOfficeVersion()
            {
                OfficeVersion version = OfficeVersion.Office2003;
                Microsoft.Win32.RegistryKey regKey = null;
                Microsoft.Win32.RegistryKey regSubKey = null;
                try
                {
                    regKey = Microsoft.Win32.Registry.LocalMachine;
                    if (regSubKey == null)
                    {//office2007
                        regSubKey = regKey.OpenSubKey(@"SOFTWAREMicrosoftOffice12.0CommonInstallRoot", false);
                        version= OfficeVersion.Office2007;
                    }
                    if (regSubKey == null)
                    {//Office2003
                        regSubKey = regKey.OpenSubKey(@"SOFTWAREMicrosoftOffice11.0CommonInstallRoot", false);
                        version= OfficeVersion.Office2003;
                    }
                }
                catch (System.Security.SecurityException ex)
                {
                    throw new System.Security.SecurityException("您没有读取注册表的权限", ex);
                }
                catch (Exception ex)
                {
                    throw new Exception("读取注册表出错!", ex);
                }
                if (regKey != null)
                {
                    regKey.Close();
                    regKey = null;
                }

                if (regSubKey != null)
                {
                    regSubKey.Close();
                    regSubKey = null;
                }
                return version;
            }

    http://bbs.csdn.net/topics/350108050

    http://hi.baidu.com/guog_/item/26a2e825f94c76d7a517b65c

  • 相关阅读:
    了解委托(Delegate)
    C#中事件的一些总结
    Devexpress Xtrareport 并排报表
    Xtrareport 交叉报表
    Xtrareport 多栏报表
    Xtrareport 报表的一些属性及控件
    UI前端开发都是做什么的以及html、css、php、js等究竟是神马关系
    url,href,src之间的区别
    join()的用法
    爬取百度百科
  • 原文地址:https://www.cnblogs.com/swarb/p/9924261.html
Copyright © 2011-2022 走看看