如题,怎么使用C#代码获得客户端所装的excel版本,并且同时判断客户端有没有安装excel

解决方案 »

  1.   

     bool ifused = false;
                RegistryKey rk = Registry.LocalMachine;
                RegistryKey akey = rk.OpenSubKey(@"SOFTWARE\\Microsoft\\Office\\11.0\\Word\\InstallRoot\\");
        
                //检查本机是否安装Office2003
                if (akey != null)
                {
                    //读取offcie03的版本
                    string file03 = akey.GetValue("Path").ToString();
                    if (File.Exists(file03 + "Microsoft.Office.Interop.Excel.exe"))
                    {
                        ifused = true;
                    }
                    //这个是WPS的。
                    else if (File.Exists(file03 + "winword.exe"))
                    {
                        ifused = true;
                    }
                }读取07的话,就把11.0改为12.0就可以了。