zoukankan      html  css  js  c++  java
  • 判断本机安装的excel版本

    public List<string> ExcelVsion()
            {  
                List<string> list=new List<string>();
                List<string> lisemp = new List<string>();
                List<string> listvison = new List<string>();
                RegistryKey rk = Registry.LocalMachine;
                RegistryKey akey = rk.OpenSubKey(@"SOFTWARE\\Microsoft\\Office");
                RegistryKey csk;
                string str;
                hash = new Hashtable();
              
                string[] ss = akey.GetSubKeyNames();
                foreach (string s in ss)
                {
                    string strem=@"SOFTWARE\\Microsoft\\Office"+@"\\"+s;
                    csk=rk.OpenSubKey(strem);
                    string[] csd = csk.GetSubKeyNames();
                    foreach (string sk in csd)
                    {
                        if (sk=="Excel")
                        {
                            str = strem + @"\\" + "Excel";
                            list.Add(str);
                            lisemp.Add(s);
                        }
                    }
                }

                if (list!=null)
                {
                    for (int index = 0; index < list.Count;index++ )
                    {
                        list[index] = list[index] + @"\\InstallRoot\\";
                        RegistryKey f = rk.OpenSubKey(list[index]);
                        if (f!=null)
                        {
                            listvison.Add(lisemp[index]);
                        }
                   
                    }

                   
                }
            
       return listvison;           
            }

    返回空值则没有安装,返回值大于1则安装了多个。

  • 相关阅读:
    JS函数机制小结
    面向对象的JS随笔
    web性能优化
    css布局
    Spark内存管理
    Scala中==,eq与equals的区别
    Java中char占用几个字节
    Java中long和double的原子性
    elk-filebeat收集docker容器日志
    Spring Boot多数据源配置(二)MongoDB
  • 原文地址:https://www.cnblogs.com/jinyuttt/p/2104238.html
Copyright © 2011-2022 走看看