zoukankan      html  css  js  c++  java
  • 通过访问注册表,表判断系统是否装excel

            #region 判断系统是否装excel
            /// <summary>
            /// 判断系统是否装excel
            /// </summary>
            /// <returns></returns>
            public static bool IsInstallExcel()
            {
                RegistryKey machineKey = Registry.LocalMachine;
                if (IsInstallExcelByVersion("12.0", machineKey))
                {
                    return true;
                }
                if (IsInstallExcelByVersion("11.0", machineKey))
                {
                    return true;
                }
                return false;
            }
            #endregion

            #region 判断系统是否装某版本的excel
            /// <summary>
            /// 判断系统是否装某版本的excel
            /// </summary>
            /// <param name="strVersion">版本号</param>
            /// <param name="machineKey"></param>
            /// <returns></returns>
            private static bool IsInstallExcelByVersion(string strVersion, RegistryKey machineKey)
            {
                try
                {
                    RegistryKey installKey = machineKey.OpenSubKey("Software").OpenSubKey("Microsoft").OpenSubKey("Office").OpenSubKey(strVersion).OpenSubKey("Excel").OpenSubKey("InstallRoot");
                    if (installKey == null)
                    {
                        return false;
                    }
                    return true;
                }
                catch
                {
                    return false;
                }
            }
            #endregion

  • 相关阅读:
    iOS之POST与GET的优缺点
    iOS之设置头像(访问系统相册、本地上传)
    iOS之清除缓存
    iOS之自动调节输入文本框的高度
    iOS之隐藏键盘的方式
    iOS之关于 srand() 和rand()
    Android Studio移除模块
    Android 弹出输入框
    webApi添加视图出现/Index.cshtml”处的视图必须派生自 WebViewPage 或 WebViewPage<TModel>。
    JSON Web Tokens简单学习
  • 原文地址:https://www.cnblogs.com/tangtang615/p/1402908.html
Copyright © 2011-2022 走看看