2016-11-16 113 views
0

我想開發一個字插件遵循本指南:辦公室插件表現

https://dev.office.com/docs/add-ins/word/word-add-ins

我做的一切相同指導,但是當我嘗試在Word中打開它,我得到一個錯誤:

addin error: We could not initialize this addin

addin error: Wrong configuration

我想有一些錯誤的,我標籤SourceLocation

這是我的XML:

<?xml version="1.0" encoding="UTF-8"?> 
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xsi:type="TaskPaneApp"> 
    <Id>fd3731db-b538-4e32-819f-b09b801894e8</Id> 
    <Version>1.0.0.0</Version> 
    <ProviderName>Microsoft</ProviderName> 
    <DefaultLocale>en-US</DefaultLocale> 
    <DisplayName DefaultValue="Boilerplate content" /> 
    <Description DefaultValue="Insert boilerplate content into a Word document." /> 
    <Hosts> 
     <Host Name="Document"/> 
    </Hosts> 
    <DefaultSettings> 
     <SourceLocation DefaultValue="http://localhost:8080/boilerplate/home.html" /> 
    </DefaultSettings> 
    <Permissions>ReadWriteDocument</Permissions> 
</OfficeApp> 

我也tryed與共享文件夾:

<SourceLocation DefaultValue="\\MyShare\boilerplate\home.html" /> 

NB: I'm testing in Word Online

回答

1

的外接只能通過HTTPS送達(SSL ) 如解釋here

確保您可以與您的瀏覽器https://localhost:8080/boilerplate/home.html

您可能需要繞過瀏覽器的警告有關證書,也可以安裝一個selfsigned certificate for localhost domain直接瀏覽網址。當你回到web插件 Warning: Office.js is loaded outside of Office client

當直接瀏覽外接位置URL,你應該在你的瀏覽器控制檯的警告。您還需要確保您設置了Office.initialize callback

提示: 你是對的,開始使用Office在線開發。保持您的瀏覽器devtools開放,不要忘記禁用緩存。實際上,這與普通網頁開發沒有什麼不同。