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

  • 相关阅读:
    MyISAM表锁的解决方案
    RSA数字证书管理
    Self Host WebApi服务传输层SSL加密(服务器端+客户端调用)
    WebApi服务Uri加密及验证的两种方式
    利用MVC的自定义过滤器FilterAttribute、IActionFilter、IExceptionFilter实现异常处理等功能
    html页面中meta的作用
    [转]REST简介
    [转]webApi 参数传递总结
    REST服务中的异常处理
    REST服务返回自定义的HttpResponseMessage
  • 原文地址:https://www.cnblogs.com/swarb/p/9924261.html
Copyright © 2011-2022 走看看