javascript MS Word 是否有应用程序 URL 协议?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22987005/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there an Application URL Protocol for MS Word?
提问by Gavin Fitzgerald
I'm working on a javascript front end site to run in the browser [Chrome], and I'd like to launch Word on the clients PC with their selected macros that have already been setup in Word for them on their pc.
我正在开发一个在浏览器 [Chrome] 中运行的 javascript 前端站点,我想在客户端 PC 上启动 Word,其中包含已在 Word 中为他们在他们的 PC 上设置的选定宏。
My questions is does Office [and Word] create an Application URL Protocol [MSDN how to article] for itself when installing it?
我的问题是 Office [和 Word] 在安装时是否会为自己创建一个应用程序 URL 协议 [MSDN 如何文章]?
For example, iTunes does this, with the url 'itmss://itunes.apple.com/us/app/123213213?mt=8' which, if the user has installed iTunes, will prompt them to open it.
例如,iTunes 执行此操作,使用 URL 'itmss://itunes.apple.com/us/app/123213213?mt=8',如果用户已安装 iTunes,它将提示他们打开它。
Is there a Word equivalent protocol to itmss? Can I pass the macro names to it as parameters?
是否有与 itmss 等效的 Word 协议?我可以将宏名称作为参数传递给它吗?
If there not an equivalent protocol, does anyone know how I might achieve something similar?
如果没有等效的协议,有谁知道我如何实现类似的目标?
回答by gciochina
You could try to write your link as follows:
您可以尝试按如下方式编写链接:
ms-word:ofe|u|http://example.com/myTestDocument.docx
Note that this will most likely require you to have a WEBDAV server running, that is capable of interpreting such requests.
请注意,这很可能需要您运行 WEBDAV 服务器,该服务器能够解释此类请求。
The details about what is the meaning of ofe
or u
can be found in here
ofe
或u
可以在此处找到有关含义的详细信息
This protocol is available starting Microsoft Office 2010 Service Pack 2 (yes, there are service packs for office also).
此协议从 Microsoft Office 2010 Service Pack 2 开始可用(是的,也有适用于 office 的 Service Pack)。
回答by Kevin Berridge
Office 2010 SP2 and above install URI Schemes which you can use from your website. Microsoft has documentation for these available here: https://msdn.microsoft.com/en-us/library/office/dn906146.aspx
Office 2010 SP2 及更高版本安装了您可以从您的网站使用的 URI 方案。Microsoft 在此处提供了这些文档:https: //msdn.microsoft.com/en-us/library/office/dn906146.aspx
There is a protocol for each of the office products. The MS Word protocol is ms-word:<command-name>"|"<command-argument-descriptor>"|"<command-argument>"
每个办公产品都有一个协议。MS Word 协议是ms-word:<command-name>"|"<command-argument-descriptor>"|"<command-argument>"
You probably want the "open for edit" command which looks like this: ms-word:ofe|u|<document-uri>
您可能需要如下所示的“打开以进行编辑”命令: ms-word:ofe|u|<document-uri>