zoukankan      html  css  js  c++  java
  • 导出Excel之判断电脑中office的版本

    引用空间

    using Microsoft.Win32;
    using System.IO;


            public bool ExistsRegedit()
            {
                bool ifused = false;
                RegistryKey rk = Registry.LocalMachine;
                RegistryKey akey = rk.OpenSubKey(@"SOFTWARE\\Microsoft\\Office\\11.0\\Word\\InstallRoot\\");
                RegistryKey akeytwo = rk.OpenSubKey(@"SOFTWARE\\Microsoft\\Office\\12.0\\Word\\InstallRoot\\");
                //检查本机是否安装Office2003
                if (akey != null)
                {
                    string file03 = akey.GetValue("Path").ToString();
                    if (File.Exists(file03 + "Excel.exe"))
                    {
                        ifused = true;
                    }
                }
                //检查本机是否安装Office2007
                if (akeytwo != null)
                {
                    string file07 = akeytwo.GetValue("Path").ToString();
                    if (File.Exists(file07 + "Excel.exe"))
                    {
                        ifused = true;
                    }
                }
                return ifused;
            }

    转 

  • 相关阅读:
    常用方法 反射常见方法
    常用方法 字符串是否是中文
    常用方法 读取 Excel的单位格 为 日期格式 的数据
    常用方法 保证数据长度相同
    常用方法 简单缓存
    P1821 [USACO07FEB]银牛派对Silver Cow Party
    P3905 道路重建
    关于宏定义
    P3512 [POI2010]PIL-Pilots
    P2398 GCD SUM
  • 原文地址:https://www.cnblogs.com/likeyou/p/2847330.html
Copyright © 2011-2022 走看看