实际上我需要知道是否安装了2013版本的MS Office。方法
var oApplication=new ActiveXObject("Word.Application");
在网站上对我不起作用(但在本地磁盘上运行时起作用)。
我在Office365中调试:
ms powerpoint:ofe|u|https://....=>功率点
ms-word:ofe|u|https://=>单词
ms-excel:ofe|u|https://=>excel
您无法从IE中的Internet区域实例化未标记为"脚本安全"的ActiveX控件(Office应用程序不是SFS)。
在Office 2013之前,您使用了什么"旧机制"?您计划使用什么"新机制"?
(请记住,SharePoint可以在不进行版本检测的情况下与新旧Office客户端正常工作)。
Okey,答案如下(SharePoint可以在没有版本检测的情况下与新旧Office客户端正常工作,因此必须有解决方案)
try {
var g = new ActiveXObject("SharePoint.OpenDocuments.5");
alert('Office 2013 installed');
window.open('ms-word:ofe|u|http://server.com/12.docx');
}
catch (h) {
alert('Office 2010/older installed');
var g = new ActiveXObject("SharePoint.OpenDocuments");
g.EditDocument('http://server.com/12.docx');
}
剩下的唯一问题是在"受保护视图"中打开文档,而SharePoint则在常规视图中打开文档。