Using JavaScript to determine the Office version is useful in project development, by being an online Office editor in OA system, where we need to have Office Online editing tools that support multiple versions of Office, such as Office2003, 2007. Office writes the key value in the registry when it is installed, in Hkey_current_user/software/microsoft/office.
We can see the version of Office by opening the Registry, and the Office version corresponds to the registry key values as follows:
11.0 office2003;
12.0 office2007;
14.0 office2010;
Here's the code listing:
var version= ""; function Readofficeversion () {var word=null; try {word=new ActiveXObject ("W Ord.application "); }catch (e) {alert (1), check that your machine has Microsoft Office 2003/2007;/n2 installed, and that you check that your browser settings enable ActiveX controls. "); } if (word. version=== "11.0") {version= "office2003";} else if (word. version=== "12.0") {version= "office2007";} else if (word. version=== "14.0") {version= "office2010";}//close Word process in a timely manner. Application.Quit (); return version; }