简体   繁体   English

是否可以以编程方式将内置命令添加到加载项功能区选项卡?

[英]Is it possible to programmatically add built-in command to Add-in ribbon tab?

We have built a Word Add-In using the Office Add-in platform SDKs (JavaScript).我们使用 Office 插件平台 SDK (JavaScript) 构建了一个 Word 插件。

The Add-In includes a custom ribbon tab (defined in the Manifest.xml).加载项包括一个自定义功能区选项卡(在 Manifest.xml 中定义)。 We've been asked to add the "Text Styles" built-in command button to the custom ribbon.我们被要求将“文本样式”内置命令按钮添加到自定义功能区。 It's possible to add this manually by right-clicking and customising the toolbar.可以通过右键单击并自定义工具栏来手动添加它。

[ [在此处输入图像描述 ] ]

We'd like to roll this out to all users on a larger scale – is it possible to add this customisation programmatically through our Add-In (manifest.xml)?我们希望更大规模地向所有用户推出此功能——是否可以通过我们的插件 (manifest.xml) 以编程方式添加此自定义?

I've tried to change the manifest.xml file to reference the StylesPane command but this wasn't successful.我尝试更改 manifest.xml 文件以引用 StylesPane 命令,但这并不成功。 I've also researched other ways to customise the "Office Fluent Ribbon" by following the links in this GitHub repo , specifically Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3) |我还研究了通过此GitHub 存储库中的链接自定义“Office Fluent Ribbon”的其他方法,特别是为开发人员自定义 2007 Office Fluent Ribbon(第 1 部分,共 3 部分)| Microsoft Docs however these instructions seem to be targeted to the older COM add-in model for Office and not the newer JavaScript-based Office Add-in platform. Microsoft Docs但是这些说明似乎针对的是旧的 COM 插件 model for Office,而不是较新的基于 JavaScript 的 Office 插件平台。

Is it even possible to add or reference built-in commands in a custom ribbon?甚至可以在自定义功能区中添加或引用内置命令吗?

You can insert built-in Office buttons into your custom control groups on the Office ribbon by using markup in the add-in's manifest.您可以使用加载项清单中的标记将内置 Office 按钮插入到 Office 功能区上的自定义控件组中。 You can also insert entire built-in Office control groups into your custom ribbon tabs.您还可以将整个内置 Office 控制组插入到自定义功能区选项卡中。

To insert a built-in Office control into a custom group, add an OfficeControl element as a child element in the parent element.要将内置 Office 控件插入自定义组,请将 OfficeControl 元素添加为父元素中的子元素。 The id attribute of the element is set to the ID of the built-in control.元素的 id 属性设置为内置控件的 ID。 See Find the IDs of controls and control groups .请参阅查找控件和控件组的 ID

The following markup example adds the Office Superscript control to a custom group and positions it to appear just after a custom button:以下标记示例将 Office Superscript控件添加到自定义组,并将其放置在自定义按钮之后:

<ExtensionPoint xsi:type="ContosoRibbonTab">
  <CustomTab id="Contoso.TabCustom2">
    <Group id="Contoso.TabCustom2.group1">
        <Label resid="residCustomTabGroupLabel"/>
        <Icon>
            <bt:Image size="16" resid="blue-icon-16" />
            <bt:Image size="32" resid="blue-icon-32" />
            <bt:Image size="80" resid="blue-icon-80" />
        </Icon>
        <Control xsi:type="Button" id="Contoso.Button1">
            <!-- information on the control omitted -->
        </Control>
        <OfficeControl id="Superscript" />
        <!-- other controls, as needed -->
    </Group>
    <Label resid="customTabLabel1" />
  </CustomTab>
</ExtensionPoint>

Read more about that in the Integrate built-in Office buttons into custom control groups and tabs article.将内置 Office 按钮集成到自定义控件组和选项卡一文中了解更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 具有内置自定义功能的Angular Excel加载项 - Angular excel add-in with built-in custom functions 将Js加载项添加到VSTO加载项创建的自定义功能区选项卡中 - Adding Js add-in to Custom Ribbon Tab created by VSTO add-in 带有功能区下拉菜单的加载项命令中的动态内容 - Dynamic content in Add-in command with ribbon dropdown menu Office加载项功能区-复选框 - Office Add-in Ribbon - Checkbox Outlook加载项功能区按钮未显示 - Outlook Add-in ribbon button not showing 运行时的PowerPoint Web加载项功能区操纵 - PowerPoint Web Add-In Ribbon Manipulation at Runtime 如何创建未显示在功能区上的加载项 - How to create an add-in that does not appear on the ribbon 为什么某些Mac用户无法显示Word 2016加载项(office.js)功能区选项卡? - Why does a Word 2016 Add-in (office.js) Ribbon Tab not show for some Mac users? 强制excel在更新清单XML后刷新命令功能区(用于办公室加载项) - Force excel to refresh command ribbon (for office add-in) after updating manifest XML 是否可以默认使用清单文件来强制将Office.JS加载项的功能区命令显示在highDensityLayout中? - Is it possible to force ribbon commands for an Office.JS add-in to present in highDensityLayout by default using the manifest file?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM