Javascript judges the office version example

  • 2020-03-30 02:35:48
  • OfStack

When we open the registry, we can see the version of office. The corresponding relationship between the office version and the key value of the registry is as follows:


11.0         office2003 ; 
12.0         office2007 ; 
14.0         office2010 ; 


var version="";
function readOfficeVersion()
{
    var word=null;
    try
    {
        word=new ActiveXObject("Word.application");
    }catch(e)
    {
        alert("1 Please check whether your machine has been installed Microsoft Office 2003/2007;/n2 You check that your browser Settings are enabled ActiveX The control. ");
    }
    if(word.Version==="11.0")
    {
        version="office2003";
    }
    else if(word.Version==="12.0")
    {
        version="office2007";
    }
    else if(word.Version==="14.0")
    {

        version="office2010";
    }    //Close the Word process in time
    word.Application.Quit();
    return version;
}


Related articles: