Word 2013 RTM Javascript API兼容性

时间:2018-03-22 17:40:40

标签: xml ms-word office-js

尝试在Word 2013 RTM(15.0.4420.1017)中加载任务窗格加载项(Office for Javascript API)清单时,加载项不会显示在共享文件夹应用程序目录中。

共享文件夹显示消息"当前没有可用的应用。"。将其加载到Word 2013 SP1使用者(15.0.5015.1000)时,它确实显示在受信任文件夹应用程序目录中。

Word 2013 RTM是否与Office的Javascript API兼容?如果没有,基于Javascript API for Office的应用程序所需的最低版本是多少?如果它兼容,可能是应用程序没有显示的原因是什么?

下面是截图,首先是工作系统,然后是不加载的系统:

Working environment, 15.0.5015.1000

Not working environment, 15.0.4420.1017

我确信XML清单是有效的,它已经过验证,并且在应用程序实际工作的系统之一上。此外,两个系统上的设置也以相同的方式完成(通过与我共享一个文件夹来获取网络位置,将其添加到目录并重新启动单词)。

还有版本的截图,首先是工作系统,然后是不加载的系统:

Working environment

Not working environment

在我正在使用的清单副本下方,编辑了相关信息。在我的另一台机器上,localhost显然被我的外部IP替换,并且端口被正确转发(我可以访问Chrome中的服务器)。

<?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">
    <!-- Begin Basic Settings: Add-in metadata, used for all versions of Office unless override provided. -->
    <!-- IMPORTANT! Id must be unique for your add-in, if you reuse this manifest ensure that you change this id to a new GUID. -->
    <Id>23639468-3a3d-4875-ac5e-b1c5e4778d28</Id>
    <!--Version. Updates from the store only get triggered if there is a version change. -->
    <Version>1.0.0.0</Version>
    <ProviderName>Author</ProviderName>
    <DefaultLocale>en-US</DefaultLocale>
    <!-- The display name of your add-in. Used on the store and various places of the Office UI such as the add-ins dialog. -->
    <DisplayName DefaultValue="Displayname"/>
    <Description DefaultValue="Description"/>
    <!-- Icon for your add-in. Used on installation screens and the add-ins dialog. -->
    <IconUrl DefaultValue="https://localhost:3000/assets/icon-32.png" />
    <HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/icon-80.png"/>
    <SupportUrl DefaultValue="https://contoso.com/support " />
    <!--If you plan to submit this add-in to the Office Store, uncomment the SupportUrl element below-->
    <!--<SupportUrl DefaultValue="[Insert the URL of a page that provides support information for the app]">-->
    <!-- Domains that will be allowed when navigating. For example, if you use ShowTaskpane and then have an href link, navigation will only be allowed if the domain is on this list. -->
    <AppDomains>
        <AppDomain>AppDomain1</AppDomain>
        <AppDomain>AppDomain2</AppDomain>
        <AppDomain>AppDomain3</AppDomain>
    </AppDomains>
    <!--End Basic Settings. -->
    <!--Begin TaskPane Mode integration. This section is used if there are no VersionOverrides or if the Office client version does not support add-in commands. -->
    <Hosts>
        <Host Name="Document" />
    </Hosts>
    <DefaultSettings>
        <SourceLocation DefaultValue="https://localhost:3000/index.html" />
    </DefaultSettings>
    <!-- End TaskPane Mode integration.  -->
    <Permissions>ReadWriteDocument</Permissions>
    <!-- Begin Add-in Commands Mode integration. -->
    <VersionOverrides 
        xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
        <!-- The Hosts node is required. -->
        <Hosts>
            <!-- Each host can have a different set of commands. -->
            <!-- Excel host is Workbook, Word host is Document, and PowerPoint host is Presentation. -->
            <!-- Make sure the hosts you override match the hosts declared in the top section of the manifest. -->
            <Host xsi:type="Document">
                <!-- Form factor. Currently only DesktopFormFactor is supported. -->
                <DesktopFormFactor>
                    <!--"This code enables a customizable message to be displayed when the add-in is loaded successfully upon individual install."-->
                    <GetStarted>
                        <!-- Title of the Getting Started callout. resid points to a ShortString resource -->
                        <Title resid="Contoso.GetStarted.Title"/>
                        <!-- Description of the Getting Started callout. resid points to a LongString resource -->
                        <Description resid="Contoso.GetStarted.Description"/>
                        <!-- Point to a url resource which details how the add-in should be used. -->
                        <LearnMoreUrl resid="Contoso.GetStarted.LearnMoreUrl"/>
                    </GetStarted>
                    <!-- Function file is a HTML page that includes the JavaScript where functions for ExecuteAction will be called.
                Think of the FunctionFile as the code behind ExecuteFunction. -->
                    <FunctionFile resid="Contoso.DesktopFunctionFile.Url" />
                    <!-- PrimaryCommandSurface is the main Office Ribbon. -->
                    <ExtensionPoint xsi:type="PrimaryCommandSurface">
                        <!-- Use OfficeTab to extend an existing Tab. Use CustomTab to create a new tab. -->
                        <OfficeTab id="TabHome">
                            <!-- Ensure you provide a unique id for the group. Recommendation for any IDs is to namespace using your company name. -->
                            <Group id="Contoso.Group1">
                                <!-- Label for your group. resid must point to a ShortString resource. -->
                                <Label resid="Contoso.Group1Label" />
                                <!-- Icons. Required sizes 16,32,80, optional 20, 24, 40, 48, 64. Strongly recommended to provide all sizes for great UX. -->
                                <!-- Use PNG icons. All URLs on the resources section must use HTTPS. -->
                                <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. It can be of type "Button" or "Menu". -->
                                <Control xsi:type="Button" id="Contoso.TaskpaneButton">
                                    <Label resid="Contoso.TaskpaneButton.Label" />
                                    <Supertip>
                                        <!-- ToolTip title. resid must point to a ShortString resource. -->
                                        <Title resid="Contoso.TaskpaneButton.Label" />
                                        <!-- ToolTip description. resid must point to a LongString resource. -->
                                        <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>
                                    <!-- This is what happens when the command is triggered (E.g. click on the Ribbon). Supported actions are ExecuteFunction or ShowTaskpane. -->
                                    <Action xsi:type="ShowTaskpane">
                                        <TaskpaneId>ButtonId1</TaskpaneId>
                                        <!-- Provide a url resource id for the location that will be displayed on the task pane. -->
                                        <SourceLocation resid="Contoso.Taskpane.Url" />
                                    </Action>
                                </Control>
                            </Group>
                        </OfficeTab>
                    </ExtensionPoint>
                </DesktopFormFactor>
            </Host>
        </Hosts>
        <!-- You can use resources across hosts and form factors. -->
        <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>
            <!-- ShortStrings max characters==125. -->
            <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>
            <!-- LongStrings max characters==250. -->
            <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>
    <!-- End Add-in Commands Mode integration. -->
</OfficeApp>

我也尝试将xmlns="http://schemas.microsoft.com/office/appforoffice/1.1"更改为xmlns="http://schemas.microsoft.com/office/appforoffice/1.0"

1 个答案:

答案 0 :(得分:0)

Office的不同版本对各种API有不同的支持。在您的清单中,似乎您希望使用命令(功能区按钮)并支持那些在Office 2016之前未引入的功能。不同API的特定版本号记录在需求集上:https://docs.microsoft.com/en-us/office/dev/add-ins/develop/office-versions-and-requirement-sets

如果您需要创建与Office 2013 RTM一起使用的加载项(当时支持的API很少),您将需要该版本的Office可以理解的清单。我没有一个,但粗略地回顾一下您的清单信号,比如我认为RTM中不支持的节点和节点。

我的建议是从SP1开始作为最低限度。