【问题标题】:MS Office 2016 Build a ribbon using office-jsMS Office 2016 使用 office-js 构建功能区
【发布时间】:2021-02-02 19:38:18
【问题描述】:

我知道您可以使用 VSTO 和 COMM 插件构建完整的功能区。您能否使用 MS Word 2016 的新 office-js 构建这些?

我找不到任何方法。或者,我想知道我们是否可以构建一个 VSTO 插件功能区来打开我们的 office-js 插件?

我们只希望功能区看起来不错,而不是在插入 -> 我的加载项 -> 中,如下所示:

以下是我按照https://docs.microsoft.com/en-us/office/dev/add-ins/design/contextual-tabs 上的说明操作的内容:

<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>260eddsdd5</Id>
  <Version>1.0.0.0</Version>
  <ProviderName>Contoso</ProviderName>
  <DefaultLocale>en-US</DefaultLocale>
  <DisplayName DefaultValue=" Local"/>
  <Description DefaultValue=" Add-in"/>
  <IconUrl DefaultValue="https://localhost/dw/assets/icon-80.png"> </IconUrl>
  <HighResolutionIconUrl DefaultValue="https://localhost/dw/assets/icon-80.png"/>
  <SupportUrl DefaultValue="https://help"/>
  <AppDomains>
    <AppDomain>localhost/dw</AppDomain>
  </AppDomains>
  <Hosts>
    <Host Name="Document"/>
  </Hosts>
  <DefaultSettings>
    <SourceLocation DefaultValue="https://localhost/dw/taskpane.html"/>
  </DefaultSettings>
  <Permissions>ReadWriteDocument</Permissions>
  <VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
    <Hosts>
      <Host xsi:type="Document">
        <DesktopFormFactor>
          <GetStarted>
            <Title resid="GetStarted.Title"/>
            <Description resid="GetStarted.Description"/>
            <LearnMoreUrl resid="GetStarted.LearnMoreUrl"/>
          </GetStarted>
          <FunctionFile resid="Commands.Url"/>
          <ExtensionPoint xsi:type="PrimaryCommandSurface">
            <CustomTab id="TabCustom1">
              <Group id="myCustomTab.grp1">
                <Label resid="residCustomTabGroupLabel"/>
                <Icon>
                  <bt:Image size="16" resid="Icon.16x16"/>
                  <bt:Image size="32" resid="Icon.32x32"/>
                  <bt:Image size="80" resid="Icon.80x80"/>
                </Icon>
                <Control xsi:type="Button" id="TaskpaneButton">
                  <Label resid="TaskpaneButton.Label"/>
                  <Supertip>
                    <Title resid="TaskpaneButton.Label"/>
                    <Description resid="TaskpaneButton.Tooltip"/>
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="Icon.16x16"/>
                    <bt:Image size="32" resid="Icon.32x32"/>
                    <bt:Image size="80" resid="Icon.80x80"/>
                  </Icon>
                  <Action xsi:type="ShowTaskpane">
                    <TaskpaneId>ButtonId1</TaskpaneId>
                    <SourceLocation resid="Taskpane.Url"/>
                  </Action>
                </Control>
                <OfficeControl id="Superscript" />
              </Group>
              <OfficeGroup id="Paragraph" />
              <Label resid="customTabLabel1" />
            </CustomTab>
          </ExtensionPoint>
        </DesktopFormFactor>
      </Host>
    </Hosts>
    <Resources>
      <bt:Images>
        <bt:Image id="Icon.16x16" DefaultValue="https:///icon-16.png"/>
        <bt:Image id="Icon.32x32" DefaultValue="https://icon-32.png"/>
        <bt:Image id="Icon.80x80" DefaultValue="https://icon-80.png"/>
      </bt:Images>
      <bt:Urls>
        <bt:Url id="GetStarted.LearnMoreUrl" DefaultValue="https://go.microsoft.com/fwlink/?LinkId=276812"/>
        <bt:Url id="Commands.Url" DefaultValue="https://localhost/dw/commands.html"/>
        <bt:Url id="Taskpane.Url" DefaultValue="https://localhost/dw/taskpane.html"/>
      </bt:Urls>
      <bt:ShortStrings>
        <bt:String id="GetStarted.Title" DefaultValue="Get started !"/>
        <bt:String id="CommandsGroup.Label" DefaultValue="Click"/>
        <bt:String id="TaskpaneButton.Label" DefaultValue="Click"/>
      </bt:ShortStrings>
      <bt:LongStrings>
        <bt:String id="GetStarted.Description" DefaultValue=" add-in loaded succesfully. Go to the HOME tab and click the button to get started."/>
        <bt:String id="TaskpaneButton.Tooltip" DefaultValue="Click to Show a Taskpane"/>
      </bt:LongStrings>
    </Resources>
  </VersionOverrides>
</OfficeApp>

【问题讨论】:

    标签: office-js office-addins word-addins word-2016


    【解决方案1】:

    是的。您可以使用 Office Web 加载项自定义功能区。功能区上的自定义按钮和菜单称为加载项命令,您可以在加载项的清单中配置它们。详情请以Add-in CommandsCreate Add-in Commands开头。

    【讨论】:

    • 感谢@Rick 的消息-我通过您发送的链接进行了尝试,但该插件现在完全消失了。我在原始问题上添加了我的内容-这大致适合您吗?不知道是不是版本问题
    • 您链接到的文章是关于上下文选项卡的,它处于预览状态,Word 尚不支持。这就是你要链接的意思吗?您能否提供有关“插件消失”的更多详细信息?哪些步骤会重现问题?
    • 对不起@Rick 我在清单中发现了一些东西-因此它不起作用。目前它适用于 Word 2016 (16.0.9029.2016) 但不适用于 Word 2016 (16.0.5110.100) 你知道为什么会这样吗?
    • 根据此页面,加载项命令仅在永久许可证 Office 2016 中的 Outlook 中受支持,所以我很惊讶它在任何永久许可证 Word 2016 中都有效。docs.microsoft.com/en-us/office/dev/add-ins/reference/…
    • 可能是“加载项命令 1.1 要求集引入了自动打开包含文档的任务窗格的功能”的原因。发生了什么它还说“加载项命令 1.3 要求集引入了清单标记,使加载项能够自定义 Office 功能区上自定义选项卡的位置,并将内置 Office 功能区控件插入自定义控件组。”
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-04-24
    • 1970-01-01
    • 2011-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多