Fre*_*örk 7

如果您不需要特定的Office版本,可以通过查找其中一个办公室应用程序(例如winword.exe)的应用程序路径进行检查:

private static bool IsOfficeInstalled()
{
    RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Winword.exe");
    if (key!= null)
    {
        key.Close();
    }
    return key != null;
}
Run Code Online (Sandbox Code Playgroud)