2016-11-16 93 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开放,不要忘记禁用缓存。实际上,这与普通网页开发没有什么不同。