无法加载办公室加载项

时间:2017-07-03 15:15:46

标签: office-js

我为办公室加载项创建了一个示例清单文件。但是xml架构中存在一些问题。如果我自己评论VersionOverrides的内容,则外接程序可以正常工作。

如果有人能说出这个问题。

注意:源位置和功能文件在我的工作区中可用。

附加清单代码。

由于 作者Abhijit

<?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" xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0" xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="TaskPaneApp">
      <Id>cea85fda-84f6-4278-8d81-74126a2c3870</Id>
      <Version>1.0.0.0</Version>
      <ProviderName>Microsoft</ProviderName>
      <DefaultLocale>en-US</DefaultLocale>
      <DisplayName DefaultValue="demo Add" />
      <Description DefaultValue="demo hello"/>
      <Capabilities>
        <Capability Name="Workbook" />
      </Capabilities>
      <AppDomains>
    <AppDomain>http://localhost:8080</AppDomain>
    <AppDomain>AppDomain2</AppDomain>
    <AppDomain>AppDomain3</AppDomain>
  </AppDomains>
  <!--EndBasicSettings-->
  <!--BeginTaskpaneMode integration. Office 2013 and any client that doesn't understand commands will use this section.
    This section will also be used if there are no VersionOverrides -->
  <Hosts>
    <Host Name="Workbook" />
  </Hosts>
  <Requirements>
    <Sets DefaultMinVersion="1.1">
      <Set Name="TableBindings" />
    </Sets>
  </Requirements>
      <DefaultSettings>
        <SourceLocation DefaultValue="http://localhost:8080/excelDemo/Home.html" />
      </DefaultSettings>
      <Permissions>ReadWriteDocument</Permissions>
      <VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
         <Hosts>
            <Host xsi:type="Workbook">
                <DesktopFormFactor>
          <!--Function file is an html page that includes the javascript where functions for ExecuteAction will be called. 
            Think of the FunctionFile as the "code behind" ExecuteFunction -->
          <FunctionFile resid="residDesktopCommnadUrl" />
          <!--PrimaryCommandSurface==Main Office Ribbon-->
          <ExtensionPoint xsi:type="PrimaryCommandSurface">
            <!--Use OfficeTab to extend an existing Tab. Use CustomTab to create a new tab -->
            <!-- Documentation includes all the IDs currently tested to work -->
            <CustomTab id="SmartViewAddIns">
              <!--Group. Ensure you provide a unique id. Recommendation for any IDs is to namespace using your companyname-->

              <Label resid="residLabel5" />
            </CustomTab>

          </ExtensionPoint>
        </DesktopFormFactor>
            </Host>
         </Hosts>
         <Resources>
             <bt:Images>
                <bt:Image id="icon_login_16" DefaultValue="https://gsmadatahub-dev.corp.apple.com/opf-mac/display/icons/login.png"></bt:Image>
                <bt:Image id="icon_login_32" DefaultValue="https://gsmadatahub-dev.corp.apple.com/opf-mac/display/icons/login.png"></bt:Image>
                <bt:Image id="icon_login_80" DefaultValue="https://gsmadatahub-dev.corp.apple.com/opf-mac/display/icons/login.png"></bt:Image>
             </bt:Images>
            <bt:Urls>
                <bt:Url id="Contoso.FunctionFile.Url" DefaultValue="http://localhost:8080/excelDemo/commands.html" />
            </bt:Urls>
            <bt:ShortStrings>
                <bt:String id="Contoso.Tab1.GroupLabel" DefaultValue="Test Group" />
                <bt:String id="Contoso.FunctionButton.Label" DefaultValue="Execute Function" />
            </bt:ShortStrings>
            <bt:LongStrings>
                <bt:String id="Contoso.FunctionButton.Tooltip" DefaultValue="Click to Show Taskpane1" />
            </bt:LongStrings>
         </Resources>
      </VersionOverrides>



</OfficeApp>

2 个答案:

答案 0 :(得分:1)

清单中的问题是您使用以下行:

<Label resid="residLabel5" />

但是您没有为residLabel5定义资源。只有在定义了所有使用的资源时,清单才有效。

您可以在将以下行添加到bt时修复问题:清单中的ShortStrings是否有效。

<bt:String id="residLabel5" DefaultValue="Test" />

答案 1 :(得分:1)

要添加到Alex的答案:就一般情况而言,我建议您通过验证工具运行清单,或使用运行时日志记录来诊断清单问题。有关详细信息,请参阅https://dev.office.com/docs/add-ins/testing/troubleshoot-manifest