简体   繁体   English

MS Office Firefox插件(NPAPI)

[英]MS Office Firefox Plugin (NPAPI)

I am having trouble getting a Microsoft Office document to open in FireFox - using Microsoft's Office 2010 plugin. 我无法使用Microsoft Office 2010插件在FireFox中打开Microsoft Office文档。

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

I am trying it with the following html document in firefox. 我正在下面的Firefox文档中尝试使用html文档。 I have confirmed that the MS Office 2010 plugin is installed. 我已确认已安装MS Office 2010插件。

    <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>

I am getting the following error when inspecting in FireBug: 在FireBug中检查时出现以下错误:

hownowPlugin.EditDocument2 is not a function hownowPlugin.EditDocument2不是函数

Can anyone please point out where I am going wrong? 有人可以指出我要去哪里了吗?

There was one additional change I made to get the link to work. 为了使链接正常工作,我进行了另一项更改。

Currently, you have: 目前,您有:

hownowPlugin.EditDocument2(url, null);

I removed the 2: 我删除了2:

hownowPlugin.EditDocument(url, null);

Documentation for the FFWinPlugin can be found at http://msdn.microsoft.com/en-us/library/ff407576.aspx . FFWinPlugin的文档可以在http://msdn.microsoft.com/zh-cn/library/ff407576.aspx中找到。

I'm doing a similar project where I need to support multiple browsers. 我正在做一个类似的项目,需要支持多个浏览器。 My original edit code was from Milton ( http://milton.io/index.html ). 我最初的编辑代码来自Milton( http://milton.io/index.html )。 It only worked in IE. 它仅在IE中有效。 Pooling together the IE code and the Firefox code, I was able to come up with this. 将IE代码和Firefox代码集中在一起,我就能想到这一点。

<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>

By the way, i had trouble making this work in Firefox. 顺便说一句,我在Firefox中无法正常工作。 One thing to mention, is the path to the document needs to be absolute and not relative. 值得一提的是,文档路径必须是绝对路径,而不是相对路径。

    var hownowPlugin = document.getElementById("winFirefoxPlugin");
    var version = hownowPlugin.GetOfficeVersion();
    hownowPlugin.EditDocument("http://example.com/word.doc", version);

I don't have that plugin, but maybe it doesn't work because of a typo (error on the Microsoft page). 我没有该插件,但也许由于错字(Microsoft页面上的错误)而无法使用。 You have 你有

type=”application/x-sharepoint"

instead of 代替

type="application/x-sharepoint"

(first quote) (第一引号)

Also give ! 还给! in the <!doctype html> <!doctype html>

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

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