# Region Query the registry and determine whether the local machine is installed with office2003, 2007, and WPS
Public int existsregedit () {int ifused = 0; registrykey rk = registry. localmachine; // query office2003 registrykey f03 = rk. opensubkey (@ "SOFTWARE \ Microsoft \ Office \ 11.0 \ Excel \ installroot \"); // query office2007 registrykey f07 = rk. opensubkey (@ "SOFTWARE \ Microsoft \ Office \ 12.0 \ Excel \ installroot \"); // query WPS registrykey WPS = rk. opensubkey (@ "SOFTWARE \ Kingsoft \ Office \ 6.0 \ common \"); // check whether the local machine has office2003 if (f03! = NULL) {string file03 = f03.getvalue ("path "). tostring (); If (file. exists (file03 + "excel.exe") ifused + = 1;} // check whether the local machine has office2007 if (f07! = NULL) {string file07 = akey. getvalue ("path "). tostring (); If (file. exists (file07 + "excel.exe") ifused + = 2;} // check whether WPS is installed on the local machine if (WPS! = NULL) {string filewps = akeytwo. getvalue ("installroot "). tostring (); If (file. exists (filewps + @ "\ office6 \ et.exe") ifused + = 4;} return ifused ;}