2012-01-03 60 views
2

我在使用Microsoft Office 2010插件獲取要在FireFox中打開的Microsoft Office文檔時遇到了問題。MS Office Firefox插件(NPAPI)

請參閱http://msdn.microsoft.com/en-us/library/ff407576.aspx

我跟在Firefox下的HTML文檔嘗試它。我已經確認安裝了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> 

我得到在Firebug檢查時出現以下錯誤:

hownowPlugin.EditDocument2不是一個函數

任何人都可以請指出我要去的地方錯了嗎?

+3

歡迎來到StackOverflow。我沒有在這裏看到一個問題,並且說「我有問題」,沒有說明可能會出現什麼「麻煩」,或者您收到的任何錯誤消息都沒有用處。請編輯您的文本以詢問實際問題並澄清您遇到的問題,以便我們獲得有關嘗試和幫助您的信息。謝謝。 :) – 2012-01-03 01:00:53

+0

謝謝你,我已經更新了這個問題:) – 2012-01-03 01:46:43

回答

1

我沒有那個插件,但也許因爲輸入錯誤而無法工作(Microsoft網頁上的錯誤)。你有

type=」application/x-sharepoint" 

代替

type="application/x-sharepoint" 

(第一次報價)

也給!<!doctype html>

+0

它排序:) – 2012-01-04 00:21:04

+0

這是否也適用於Chrome? – Aruna 2016-03-14 17:37:07

2

有我做獲得的鏈接工作一個額外的變化。

目前,您有:

hownowPlugin.EditDocument2(url, null); 

我刪除了2:爲FFWinPlugin

hownowPlugin.EditDocument(url, null); 

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

我正在做一個類似的項目,我需要支持多種瀏覽器。我的原始編輯代碼來自Milton(http://milton.io/index.html)。它只在IE中工作。將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> 
1

順便說一句,我在麻煩在Firefox做這項工作。 有一點要提到的是,文檔的路徑需要是絕對的而不是相對的。

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