1

我有一个 Office 加载项/TaskPane 应用程序。

当我尝试在 manifest.xml 中指定为此应用程序设置的要求时,我收到以下错误office-addin-validator

命名空间中的元素OfficeApp在命名空间中http://schemas.microsoft.com/office/appforoffice/1.1有无效的子元素Requirementshttp://schemas.microsoft.com/office/appforoffice/1.1

该文档非常清楚地表明Requirements,实际上在这个位置是允许的。

我可以在VersionOverrides标签内添加要求集,该部分如下所示:

<VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
    <Requirements>
        <bt:Sets>
            <bt:Set Name="ExcelApi" MinVersion="1.1"/>
        </bt:Sets>
    </Requirements>
    <!--- ... -->
</VersionOverrides>

但是,office-addin-validator不能正确识别不支持旧版本的 Excel。

这样做的正确方法是什么?我不知道这是office-addin-validator工具中的错误还是过时的文档。

编辑

这是一个失败的清单:

<?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>999dfa02-364b-450c-a66b-b4baaae2e6f9</Id>
    <Version>1.0.0.0</Version>
    <ProviderName>[Provider name]</ProviderName>
    <DefaultLocale>en-US</DefaultLocale>
    <DisplayName DefaultValue="My Office Add-in" />
    <Description DefaultValue="[Workbook Add-in description]"/>
    <IconUrl DefaultValue="https://localhost:3000/assets/icon-32.png" />
    <HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/hi-res-icon.png"/>
    <SupportUrl DefaultValue="[Insert the URL of a page that provides support information for the app]"/>
    <AppDomains>
        <AppDomain>AppDomain1</AppDomain>
        <AppDomain>AppDomain2</AppDomain>
        <AppDomain>AppDomain3</AppDomain>
    </AppDomains>
    <Hosts>
        <Host Name="Workbook" />
    </Hosts>
    <DefaultSettings>
        <SourceLocation DefaultValue="https://localhost:3000/index.html" />
    </DefaultSettings>
    <Permissions>ReadWriteDocument</Permissions>
    <VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
        <Hosts>
            <Host xsi:type="Workbook">
                <DesktopFormFactor>
                    <GetStarted>
                        <Title resid="Contoso.GetStarted.Title"/>
                        <Description resid="Contoso.GetStarted.Description"/>
                        <LearnMoreUrl resid="Contoso.GetStarted.LearnMoreUrl"/>
                    </GetStarted>
                    <FunctionFile resid="Contoso.DesktopFunctionFile.Url" />
                    <ExtensionPoint xsi:type="PrimaryCommandSurface">
                        <OfficeTab id="TabHome">
                            <Group id="Contoso.Group1">
                                <Label resid="Contoso.Group1Label" />
                                <Icon>
                                    <bt:Image size="16" resid="Contoso.tpicon_16x16" />
                                    <bt:Image size="32" resid="Contoso.tpicon_32x32" />
                                    <bt:Image size="80" resid="Contoso.tpicon_80x80" />
                                </Icon>
                                <Control xsi:type="Button" id="Contoso.TaskpaneButton">
                                    <Label resid="Contoso.TaskpaneButton.Label" />
                                    <Supertip>
                                        <Title resid="Contoso.TaskpaneButton.Label" />
                                        <Description resid="Contoso.TaskpaneButton.Tooltip" />
                                    </Supertip>
                                    <Icon>
                                        <bt:Image size="16" resid="Contoso.tpicon_16x16" />
                                        <bt:Image size="32" resid="Contoso.tpicon_32x32" />
                                        <bt:Image size="80" resid="Contoso.tpicon_80x80" />
                                    </Icon>
                                    <Action xsi:type="ShowTaskpane">
                                        <TaskpaneId>ButtonId1</TaskpaneId>
                                        <SourceLocation resid="Contoso.Taskpane.Url" />
                                    </Action>
                                </Control>
                            </Group>
                        </OfficeTab>
                    </ExtensionPoint>
                </DesktopFormFactor>
            </Host>
        </Hosts>
        <Resources>
            <bt:Images>
                <bt:Image id="Contoso.tpicon_16x16" DefaultValue="https://localhost:3000/assets/icon-16.png" />
                <bt:Image id="Contoso.tpicon_32x32" DefaultValue="https://localhost:3000/assets/icon-32.png" />
                <bt:Image id="Contoso.tpicon_80x80" DefaultValue="https://localhost:3000/assets/icon-80.png" />
            </bt:Images>
            <bt:Urls>
                <bt:Url id="Contoso.Taskpane.Url" DefaultValue="https://localhost:3000/index.html" />
                <bt:Url id="Contoso.GetStarted.LearnMoreUrl" DefaultValue="https://go.microsoft.com/fwlink/?LinkId=276812" />
                <bt:Url id="Contoso.DesktopFunctionFile.Url" DefaultValue="https://localhost:3000/function-file/function-file.html" />
            </bt:Urls>
            <bt:ShortStrings>
                <bt:String id="Contoso.TaskpaneButton.Label" DefaultValue="Show Taskpane" />
                <bt:String id="Contoso.Group1Label" DefaultValue="Commands Group" />
                <bt:String id="Contoso.GetStarted.Title" DefaultValue="Get started with your sample add-in!" />
            </bt:ShortStrings>
            <bt:LongStrings>
                <bt:String id="Contoso.TaskpaneButton.Tooltip" DefaultValue="Click to Show a Taskpane" />
                <bt:String id="Contoso.GetStarted.Description" DefaultValue="Your sample add-in loaded succesfully. Go to the HOME tab and click the 'Show Taskpane' button to get started." />
            </bt:LongStrings>
        </Resources>
    </VersionOverrides>
    <Requirements>
        <Sets DefaultMinVersion="1.1">
            <Set Name="WordApi" MinVersion="1.3"/>
            <Set Name="DialogApi"/>
            <Set Name="ImageCoercion"/>
        </Sets>
    </Requirements>
</OfficeApp>
4

1 回答 1

1

元素的顺序包含在方案中。它失败了,因为您添加Requirements的顺序错误。您需要将该部分放在该Requirements部分之前DefaultSettings

<Hosts>
    <Host Name="Workbook" />
</Hosts>
<Requirements>
    <Sets DefaultMinVersion="1.1">
        <Set Name="WordApi" MinVersion="1.3"/>
        <Set Name="DialogApi"/>
        <Set Name="ImageCoercion"/>
    </Sets>
</Requirements>    
<DefaultSettings>
    <SourceLocation DefaultValue="https://localhost:3000/index.html" />
</DefaultSettings>
于 2018-07-18T15:04:20.950 回答