源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

验证本机的excel版本的C#代码

  • 时间:2020-06-19 09:22 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:验证本机的excel版本的C#代码
[u]复制代码[/u] 代码如下:
/// <summary> /// 安装的excel的版本,0为没有安装,大于1说明安装了多个. /// </summary> /// <returns></returns> public static List<string> ExcelVersion() { 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; Hashtable 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; }
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部