首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MS Office Firefox插件(NPAPI)

MS Office Firefox插件(NPAPI)
EN

Stack Overflow用户
提问于 2012-01-03 08:17:42
回答 3查看 4.1K关注 0票数 2

我在使用微软Office2010插件在FireFox中打开Microsoft Office文档时遇到了麻烦。

请参阅http://msdn.microsoft.com/en-us/library/ff407576.aspx

我正在用firefox中的以下html文档来尝试它。我已确认已安装MS Office 2010插件。

代码语言:javascript
复制
    <doctype html>
    <html>
    <head>
    <script>
    function OpenWebDavDocument(url, extension) {
        debugger;
        var hownowPlugin = document.getElementById("winFirefoxPlugin");
        hownowPlugin.EditDocument2(url, null)
    }
    </script>
    </head>
    <body>
        <object id="winFirefoxPlugin" type=”application/x-sharepoint">
        <a href="#" onclick="OpenWebDavDocument('bfd42001/hownow/files/Records/12182', 'xlsx')" style="">Excel Doc</a>
        <a href="#" onclick="OpenWebDavDocument('hbfd42001/hownow/files/Records/8924', 'docx')" style="">Word Doc</a>
    </body>
    </html>

在FireBug中检查时出现以下错误:

hownowPlugin.EditDocument2不是一个函数

有谁能指出我哪里错了吗?

EN

回答 3

Stack Overflow用户

发布于 2012-05-23 03:10:43

为了让链接起作用,我还做了一个额外的修改。

目前,您拥有:

代码语言:javascript
复制
hownowPlugin.EditDocument2(url, null);

我删除了2:

代码语言:javascript
复制
hownowPlugin.EditDocument(url, null);

可以在http://msdn.microsoft.com/en-us/library/ff407576.aspx上找到FFWinPlugin的文档。

我正在做一个类似的项目,我需要支持多个浏览器。我最初的编辑代码来自于Milton ( http://milton.io/index.html )。它只在IE中有效。把IE代码和Firefox代码放在一起,我就能想出这个。

代码语言:javascript
复制
<script type="text/javascript">
    var fNewDoc = false;
    var EditDocumentButton = null;
    try {
        EditDocumentButton = new ActiveXObject('SharePoint.OpenDocuments.3');
        if (EditDocumentButton != null) { fNewDoc = true; }
    } catch(e) {}

    var L_EditDocumentError_Text = "Editing not supported.";
    var L_EditDocumentRuntimeError_Text = "Sorry, couldn't open the document.";

    function editDocument(strDocument) {
        if (fNewDoc) {
            if (!EditDocumentButton.EditDocument(strDocument)) {
                alert(L_EditDocumentRuntimeError_Text);
            }
        } else {
            try {
                var hownowPlugin = document.getElementById("winFirefoxPlugin");
                hownowPlugin.EditDocument(strDocument, null);
            } catch (e) { alert(L_EditDocumentError_Text); }
        }
    }
</script>
<object id="winFirefoxPlugin" type="application/x-sharepoint" width="0" height="0" style="visibility: hidden;"></object>
票数 2
EN

Stack Overflow用户

发布于 2012-01-03 10:40:48

我没有那个插件,但可能是因为打字错误(微软页面上的错误),所以它不能工作。你有

代码语言:javascript
复制
type=”application/x-sharepoint"

而不是

代码语言:javascript
复制
type="application/x-sharepoint"

(第一句话)

还可以在<!doctype html>中提供!

票数 1
EN

Stack Overflow用户

发布于 2013-04-08 06:22:48

顺便说一句,我在Firefox中工作时遇到了麻烦。值得一提的是,文档的路径需要是绝对的,而不是相对的。

代码语言:javascript
复制
    var hownowPlugin = document.getElementById("winFirefoxPlugin");
    var version = hownowPlugin.GetOfficeVersion();
    hownowPlugin.EditDocument("http://example.com/word.doc", version);
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8706668

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档