简体   繁体   English

使用 C# 启动 Microsoft Office(UWP 应用程序)

[英]Starting Microsoft Office (UWP app) with C#

I want to start Microsoft Office with Process.Start(path) of C#.我想用 C# 的 Process.Start(path) 启动 Microsoft Office。 But I couldn't do it because I don't know the path of the Office.exe(What I want to start is not Office programs like powerpoint, excel etc, but the collection app of them.)但是我做不到,因为我不知道Office.exe的路径(我要启动的不是powerpoint,excel等Office程序,而是它们的集合应用程序。)在此处输入图像描述

Is there any way to open it with c# code?有没有办法用 c# 代码打开它?

Sorry for my bad English explanation.抱歉我的英文解释不好。

The path to the Office application can be found via the windows registry.可以通过 windows 注册表找到 Office 应用程序的路径。 If you use the registry you have two options (depending on the version of OS you have).如果您使用注册表,您有两个选项(取决于您拥有的操作系统版本)。

  1. Retrieve InstallRoot for Microsoft Office by looking here (XX.X should be replaced with Office Version, 12.0, 14.0, 16.0 etc):通过查看此处检索 Microsoft Office 的InstallRoot (XX.X 应替换为 Office 版本、12.0、14.0、16.0 等):
HKEY_LOCAL_MACHINE\Software\Microsoft\Office\XX.X\Common\InstallRoot
Value is stored the the String value "Path".
  1. Retrieve the Registered App Path for OUTLOOK.EXE here:在此处检索 OUTLOOK.EXE 的注册应用程序路径:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE
Value is stored in the String value "Path".

But for store editions of MS Office you can find settings in the virtual keys (for all of the Office apps) are stored in User.dat file at C:\Users\%username%\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium .但是对于 Microsoft Office 的商店版本,您可以在虚拟键中找到设置(适用于所有 Office 应用程序),这些设置存储在C:\Users\%username%\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium Read more about that in the Outlook Windows Store Registry article.Outlook Windows 存储注册表文章中了解更多信息。 Using a registry tracker, discovered at least some of the keys were written to HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\ .使用注册表跟踪器,发现至少有一些键被写入HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\

If you have the store version, the applications are under C:\Program Files\WindowsApps\* .如果您有商店版本,则应用程序位于C:\Program Files\WindowsApps\*下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM