Example #1
0
        //public static UtilOffice ObjOffice;

        #endregion

        /// <summary>
        /// SprawdŸ, czy jest zainstalowany Microsoft Office
        /// </summary>
        /// <param name="app"></param>
        /// <param name="ver"></param>
        /// <returns></returns>
        /// <example></example>
        public static bool IsInstalled(OfficeApp app, OfficeVer ver)
        {
            string userRoot = "HKEY_LOCAL_MACHINE";
            string verName  = GetVersionName(ver);
            string appName  = GetApplicationName(app);

            string subkey =
                string.Format(@"Software\Microsoft\Office\{0}\{1}\InstallRoot",
                              verName, appName);

            string keyName = userRoot + "\\" + subkey;

            return((string)Registry.GetValue(keyName, "Path", null) != null);
        }
Example #2
0
 private static string GetVersionName(OfficeVer ver)
 {
     return((int)ver + ".0");
 }