驗(yàn)證本機(jī)的excel版本的C#代碼
更新時(shí)間:2011年08月12日 13:14:49 作者:
安裝的excel的版本,0為沒(méi)有安裝,大于1說(shuō)明安裝了多個(gè). 需要的朋友可以參考下。
復(fù)制代碼 代碼如下:
/// <summary>
/// 安裝的excel的版本,0為沒(méi)有安裝,大于1說(shuō)明安裝了多個(gè).
/// </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;
}
您可能感興趣的文章:
- C#實(shí)現(xiàn)判斷操作系統(tǒng)是否為Win8以上版本
- C#獲取系統(tǒng)版本信息方法
- C# 獲取程序集版本、文件版本
- C#連接Excel2003和Excel2007以上版本做數(shù)據(jù)庫(kù)的連接字符串
- C#調(diào)用C++版本dll時(shí)的類(lèi)型轉(zhuǎn)換需要注意的問(wèn)題小結(jié)
- asp.net(c#)程序版本升級(jí)更新的實(shí)現(xiàn)代碼
- C#自動(dòng)判斷Excel版本使用不同的連接字符串
- C#中使用1.7版本驅(qū)動(dòng)操作MongoDB簡(jiǎn)單例子
- 磁盤(pán)配額的wmi版本(C#)
- C#如何檢測(cè)操作系統(tǒng)版本
相關(guān)文章
unity實(shí)現(xiàn)簡(jiǎn)單抽獎(jiǎng)系統(tǒng)
這篇文章主要為大家詳細(xì)介紹了unity實(shí)現(xiàn)簡(jiǎn)單抽獎(jiǎng)系統(tǒng),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-02-02
C#訪問(wèn)網(wǎng)絡(luò)共享文件夾的方法
這篇文章主要為大家詳細(xì)介紹了C#訪問(wèn)網(wǎng)絡(luò)共享文件夾的方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-05-05
C#中Equals和GetHashCode使用及區(qū)別
這篇文章主要介紹了C#中Equals和GetHashCode使用及區(qū)別,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-02-02
C#使用DropDownList綁定添加新數(shù)據(jù)的方法匯總
這篇文章主要介紹了C#使用DropDownList綁定添加新數(shù)據(jù)的方法匯總的相關(guān)資料,需要的朋友可以參考下2016-03-03

