无法在Word功能区上的自定义按钮中显示工具提示 - 错误?

时间:2017-05-31 16:15:43

标签: office-js

Word功能区中的Wikipedia按钮提供了一个提供更多详细信息的工具提示......

新的Office.js清单架构包括工具提示和超级字段的字段,但是我无法在我的普通单按钮功能区实验中显示它们。我只是将按钮标签/名称作为工具提示。

这感觉就像一个错误...表现非常挑剔,这个肯定有用。

在macOS Sierra上进行测试。

<?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>2c77d848-f893-4938-ad5f-5ea03d3608dc</Id>
<Version>1.0.0.0</Version>
<ProviderName>11trees</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<DisplayName DefaultValue="Q for Success LOCAL" />
<Description DefaultValue="Success begins with good questions! Q for Success helps streamline access to your institution's research resources while helping students master academic writing and other related skills." />
<IconUrl DefaultValue="https://www.11trees.com/images/annotate/Annotate-32x32-circle.png" />
<SupportUrl DefaultValue="https://www.11trees.com/live/support/" />

 <!--Icon for your add-in. Used on installation screens and the add-ins dialog -->

<AppDomains>
    <AppDomain>https://trees-3aac6.firebaseio.com</AppDomain>
    <AppDomain>https://www.firebaseapp.com</AppDomain>
    <AppDomain>https://www.googleapis.com</AppDomain>
    <AppDomain>https://www.facebook.com</AppDomain>
</AppDomains>

<Hosts>
    <Host Name="Document"/>
</Hosts>

<DefaultSettings>
  <!-- Local macOS -->
    <SourceLocation DefaultValue="http://localhost/AnnotateX/qWord/qHome.html" />

</DefaultSettings>

<Permissions>ReadWriteDocument</Permissions>
  <!--BeginAddinCommandsMode integration-->
  <VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
    <Hosts>
      <!--Each host can have a different set of commands. Cool huh!? -->
      <!-- Workbook=Excel Document=Word Presentation=PowerPoint -->
      <!-- Make sure the hosts you override match the hosts declared in the top section of the manifest -->
      <Host xsi:type="Document">
        <!-- Form factor. Currenly only DesktopFormFactor is supported. We will add TabletFormFactor and PhoneFormFactor in the future-->
        <DesktopFormFactor>

           <!--GetStarted information used on the callout that appears when installing the add-in.
            Ensure you have build 16.0.6769 or above for GetStarted section to work-->
          <GetStarted>
                        <!--Title of the Getting Started callout. resid points to a ShortString resource -->
                        <Title resid="11trees.GetStarted.Title"/>

                        <!--Description of the Getting Started callout. resid points to a LongString resource -->
                        <Description resid="11trees.GetStarted.Description"/>

                        <!--Not used right now but you need to provide a valid resource. We will add code in the future to consume this URL.
                            resid points to a Url resource -->
                        <LearnMoreUrl resid="11trees.GetStarted.LearnMoreUrl"/>
                    </GetStarted>

            <!--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="11trees.FunctionFile.Url" />

          <!--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 -->
            <OfficeTab id="TabReferences">
            <!--Group. Ensure you provide a unique id. Recommendation for any IDs is to namespace using your companyname-->
            <Group id="11trees.q.Group1">
              <!--Label for your group. resid must point to a ShortString resource -->
              <Label resid="11trees.Group1.Label" />
              <!--Icons. Required sizes 16,31,80, optional 20, 24, 40, 48, 64. Strongly recommended to provide all sizes for great UX -->
              <!--Use PNG icons and remember that all URLs on the resources section must use HTTPS -->
              <Icon>
                <bt:Image size="16" resid="11trees.TaskpaneButton.Icon" />
                <bt:Image size="32" resid="11trees.TaskpaneButton.Icon" />
                <bt:Image size="80" resid="11trees.TaskpaneButton.Icon" />
              </Icon>
             <!--Control. It can be of type "Button" or "Menu" -->

               <Control xsi:type="Button" id="11trees.TaskpaneButton1">
                 <Label resid="11trees.TaskpaneButton1.Label" />
                <Tooltip resid="11trees.TaskpaneButton1.Tooltip"/>
                <Supertip>
                  <Title resid="11trees.TaskpaneButton1.Label" />
                  <Description resid="11trees.TaskpaneButton1.Supertip" />
                </Supertip>
                 <Icon>
                   <bt:Image size="16" resid="11trees.TaskpaneButton.Icon" />
                   <bt:Image size="32" resid="11trees.TaskpaneButton.Icon" />
                   <bt:Image size="80" resid="11trees.TaskpaneButton.Icon" />
                 </Icon>
                 <Action xsi:type="ShowTaskpane">
                   <TaskpaneId>11trees.qforsuccess</TaskpaneId>
                    <!--Provide a url resource id for the location that will be displayed on the task pane -->
                   <SourceLocation resid="11trees.Taskpane1.Url" />
                 </Action>
               </Control>
            </Group>
          </OfficeTab>


          </ExtensionPoint>
        </DesktopFormFactor>
      </Host>
    </Hosts>
    <Resources>
      <bt:Images>
        <bt:Image id="11trees.TaskpaneButton.Icon" DefaultValue="https://www.11trees.com/images/annotate/Annotate-128x128-circle.png" />
        <bt:Image id="11trees.FunctionButton.Icon" DefaultValue="https://www.11trees.com/images/annotate/Annotate-128x128-circle.png" />
      </bt:Images>
      <bt:Urls>

<!-- Local macOS -->
        <bt:Url id="11trees.FunctionFile.Url" DefaultValue="http://localhost/AnnotateX/AnnoWord/functionFile.html" />
        <bt:Url id="11trees.Taskpane1.Url" DefaultValue="http://localhost/AnnotateX/qWord/qHome.html" />
        <bt:Url id="11trees.Taskpane2.Url" DefaultValue="http://localhost/AnnotateX/qWord/insertComment.html" />
        <bt:Url id="11trees.Taskpane3.Url" DefaultValue="http://localhost/AnnotateX/qWord/enterComment.html" /> —>



<!-- Local Windows -->
        <!-- <bt:Url id="11trees.FunctionFile.Url" DefaultValue="http://localhost/AnnotateforWord_dev/AnnotateCode/functionFile.html" /> -->
        <!-- <bt:Url id="11trees.Taskpane1.Url" DefaultValue="http://localhost/AnnotateforWord_dev/AnnotateCode/annotateHome.html" /> -->
        <!-- <bt:Url id="11trees.Taskpane2.Url" DefaultValue="http://localhost/AnnotateforWord_dev/AnnotateCode/insertComment.html" /> -->
        <!-- <bt:Url id="11trees.Taskpane3.Url" DefaultValue="http://localhost/AnnotateforWord_dev/AnnotateCode/enterComment.html" /> -->

<!-- Staging -->

        <!-- <bt:Url id="11trees.FunctionFile.Url" DefaultValue="http://localhost/AnnotateforWord_dev/AnnotateCode/functionFile.html" />
        <bt:Url id="11trees.Taskpane1.Url" DefaultValue="https://www.11trees.com/annotate/word/beta/AnnotateCode/annotateHome.html" />
        <bt:Url id="11trees.Taskpane2.Url" DefaultValue="https://www.11trees.com/annotate/word/beta/AnnotateCode/insertComment.html" />
        <bt:Url id="11trees.Taskpane3.Url" DefaultValue="https://www.11trees.com/annotate/word/beta/AnnotateCode/enterComment.html" /> -->

<!-- Production -->
        <!-- <bt:Url id="11trees.FunctionFile.Url" DefaultValue="https://www.11trees.com/annotate/word/prod/functionFile.html" />
        <bt:Url id="11trees.Taskpane1.Url" DefaultValue="https://www.11trees.com/annotate/word/prod/annotateHome.html"/>
        <bt:Url id="11trees.Taskpane2.Url" DefaultValue="https://www.11trees.com/annotate/word/prod/insertComment.html" />
        <bt:Url id="11trees.Taskpane3.Url" DefaultValue="https://www.11trees.com/annotate/word/prod/enterComment.html" /> -->

         <!--LearnMore URL currently not used -->
        <bt:Url id="11trees.GetStarted.LearnMoreUrl" DefaultValue="https://11trees.com/live/support/">
        </bt:Url>
      </bt:Urls>
      <bt:ShortStrings>
        <bt:String id="11trees.Group1.Label" DefaultValue="Q for Success">
        </bt:String>

        <bt:String id="11trees.FunctionButton.Label" DefaultValue="Execute Function" />
        <bt:String id="11trees.TaskpaneButton1.Label" DefaultValue="Home" />
         <bt:String id="11trees.Tab1.TabLabel" DefaultValue="Q" />
         <bt:String id="11trees.GetStarted.Title" DefaultValue="Q for Success was successfully added">
          <bt:Override Locale="ja-jp" Value="JA-JP Get Started Title" />
        </bt:String>
      </bt:ShortStrings>
      <bt:LongStrings>
        <bt:String id="11trees.FunctionButton.Tooltip" DefaultValue="Click to Execute Function" />
        <bt:String id="11trees.TaskpaneButton1.Tooltip" DefaultValue="Click to show Q" />
        <bt:String id="11trees.TaskpaneButton1.Supertip" DefaultValue="Click to show Q for Success and gain quick access to your institution's research resources plus help with academic writing." />
        <bt:String id="11trees.GetStarted.Description" DefaultValue="Get going by clicking the Annotate tab on the Ribbon">
          <bt:Override Locale="ja-jp" Value="JA-JP Get Started Title" />
        </bt:String>
      </bt:LongStrings>
    </Resources>
  </VersionOverrides>

</OfficeApp>

使用最新清单的代码段进行更新...

我得到了预期的结果 - 当你悬停时更多的描述 - 但内容是从LABEL而不是SUPERTIP中提取的。我不明白......

也许我误解了supertip在Office清单中的作用......

截图Screenshot of tooltip/label/supertip

按钮

<Control xsi:type="Button" id="11trees.TaskpaneButton1">
   <Label resid="11trees.TaskpaneButton1.Label" />
  <Tooltip resid="11trees.TaskpaneButton1.Tooltip"/>
  <Supertip>
    <Title resid="11trees.TaskpaneButton1.TipLabel" />
    <Description resid="11trees.TaskpaneButton1.Supertip" />
  </Supertip>
   <Icon>
     <bt:Image size="16" resid="11trees.TaskpaneButton.Icon" />
     <bt:Image size="32" resid="11trees.TaskpaneButton.Icon" />
     <bt:Image size="80" resid="11trees.TaskpaneButton.Icon" />
   </Icon>
   <Action xsi:type="ShowTaskpane">
     <TaskpaneId>11trees.qforsuccess</TaskpaneId>
      <!--Provide a url resource id for the location that will be displayed on the task pane -->
     <SourceLocation resid="11trees.Taskpane1.Url" />
   </Action>
</Control>

字符串

<bt:ShortStrings>
  <bt:String id="11trees.Group1.Label" DefaultValue="Q for Success">
  </bt:String>
  <bt:String id="11trees.FunctionButton.Label" DefaultValue="Execute Function" />
  <bt:String id="11trees.TaskpaneButton1.Label" DefaultValue="Home" />
  <bt:String id="11trees.TaskpaneButton1.TipLabel" DefaultValue="Open Q for Success to access research and writing resources." />
   <bt:String id="11trees.Tab1.TabLabel" DefaultValue="Q" />
   <bt:String id="11trees.GetStarted.Title" DefaultValue="Q for Success was successfully added">
    <bt:Override Locale="ja-jp" Value="JA-JP Get Started Title" />
  </bt:String>
</bt:ShortStrings>
<bt:LongStrings>
  <bt:String id="11trees.TaskpaneButton1.Supertip" DefaultValue="Click to show Q for Success and gain quick access to your institution's research resources plus help with academic writing." />
  <bt:String id="11trees.GetStarted.Description" DefaultValue="Get going by clicking the Q button in the References tab">
    <bt:Override Locale="ja-jp" Value="JA-JP Get Started Title" />
  </bt:String>
</bt:LongStrings>

1 个答案:

答案 0 :(得分:1)

你的清单上有几个问题。第一个是<tooltip>不再是有效元素,工具提示被<supertip>元素替换。在您的清单中,您定义了两个元素。

第二个问题是你没有正确定义<supertip>。您看到按钮标签的原因是您已将其分配给标签资源

<Title resid="11trees.TaskpaneButton1.Label" />

SuperTip应包含两个元素; TitleDescriptionTitle必须是ShortStrings资源,Description必须是LongStrings资源:

<Control xsi:type="Button" id="11trees.TaskpaneButton1">
  <Label resid="11trees.TaskpaneButton1.Label" />
  <Supertip>
    <Title resid="[ShortString ResourceId]" />
    <Description resid="[LongString ResourceId]" />
  </Supertip>
  <Icon>
    <bt:Image size="16" resid="11trees.TaskpaneButton.Icon" />
    <bt:Image size="32" resid="11trees.TaskpaneButton.Icon" />
    <bt:Image size="80" resid="11trees.TaskpaneButton.Icon" />
  </Icon>
  <Action xsi:type="ShowTaskpane">
    <TaskpaneId>11trees.qforsuccess</TaskpaneId>
    <SourceLocation resid="11trees.Taskpane1.Url" />
  </Action>
</Control>