验证本机的excel版本的C#代码
时间:2021-11-01 07:13:20
/// <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;
}
标签:excel版本
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
java多线程编程之InheritableThreadLocal
2022-02-08 21:40:32
Android实现读取NFC卡卡号示例
2021-08-06 21:08:39
Java Collections集合继承结构图_动力节点Java学院整理
2022-07-10 03:44:53
![](https://img.aspxhome.com/file/2023/4/62244_0s.png)
SSM框架+Plupload实现分块上传大文件示例
2023-06-01 01:58:21
![](https://img.aspxhome.com/file/2023/8/63048_0s.png)
Spring Bean的初始化和销毁实例详解
2023-10-28 05:56:04
Unity shader实现消融效果
2023-03-06 01:06:44
![](https://img.aspxhome.com/file/2023/4/66584_0s.gif)
使用注解@Validated和BindingResult对入参进行非空校验方式
2022-09-16 11:30:44
![](https://img.aspxhome.com/file/2023/5/66215_0s.png)
SSH框架网上商城项目第2战之基本增删查改、Service和Action的抽取
2023-06-21 19:16:23
![](https://img.aspxhome.com/file/2023/4/57494_0s.png)
从Cocos2d-x2迁移到Cocos2d-x3的过程分享
2021-06-07 23:52:28
Java8生成时间方式及格式化时间的方法实例
2021-07-28 19:58:52
详细解读Hibernate的缓存机制
2023-05-03 21:02:52
C# goto语句的具体使用
2021-07-22 22:26:22
![](https://img.aspxhome.com/file/2023/6/71766_0s.png)
Java安全之Tomcat6 Filter内存马问题
2022-11-20 07:29:23
![](https://img.aspxhome.com/file/2023/7/61027_0s.jpg)
详解Android中提示对话框(ProgressDialog和DatePickerDialog和TimePickerDialog&PopupWindow)
2023-05-10 19:27:43
Java如何给Word文档添加多行文字水印
2023-11-10 07:40:58
![](https://img.aspxhome.com/file/2023/2/58922_0s.png)
详解java构建者模式Builder
2021-11-16 18:49:32
Windows系统中使用C#编写蓝牙通信程序的简单实例
2022-03-02 00:12:10
![](https://img.aspxhome.com/file/2023/4/96344_0s.jpg)
JAVA Future类的使用详解
2023-11-04 22:51:20
![](https://img.aspxhome.com/file/2023/5/88515_0s.jpg)
C#使用NPOI导入Excel的方法详解
2021-08-29 07:39:35
C#画笔使用复合数组绘制单个矩形的方法
2022-03-20 01:41:09