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则安装了多个。

  • 相关阅读:
    基于傅里叶变换的音频重采样算法 (附完整c代码)
    自动曝光修复算法 附完整C代码
    3D Lut 电影级调色算法 附完整C代码
    之于图片主色调提取算法
    并发中的各种锁
    算法---BitMap
    高级数据结构---堆树和堆排序
    高级数据结构---赫(哈)夫曼树及java代码实现
    域名和服务器绑定及https协议更换
    高级数据结构---B树和B+树及mysql索引分析
  • 原文地址:https://www.cnblogs.com/jinyuttt/p/2104238.html
Copyright © 2011-2022 走看看