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

  • 相关阅读:
    移动端头部声明
    清除浮动绝招
    图片采用base64压缩,可以以字符串的形式传送base64给服务端转存为图片
    js cookie的封装和调用
    js 封装设计cookie
    div可编辑状态设置
    align使图片和文字居中
    布局如何做到自适应?
    Jmeter学习笔记四_压力测试
    Pycharm中配置Git版本管理
  • 原文地址:https://www.cnblogs.com/swarb/p/9924261.html
Copyright © 2011-2022 走看看