首页 > 解决方案 > customtab 和 contextcellmenu :按钮激活/取消激活

问题描述

我有一个 Excel Web 插件可以正常工作:

一个包含五个控制按钮的自定义选项卡 一个菜单控件添加到 contextmenucell..

然而,激活和停用按钮仍然存在一些困难。

'<'Enabled'>false<'/Enabled'>' XML 指令引发«无效子元素»消息

标签: excelxmlbuttonoffice-jscontextmenu

解决方案


您需要将<Enabled>标签粘贴到控件元素中:

<Control xsi:type="Button" id="residLabel6" >
  <Label resid="residLabel6" />
    <Supertip>
      <Title resid="residLabel6"  />
      <Description resid="Contoso.TaskpaneButton.Réinit"  />
    </Supertip>
    <Icon>
      <bt:Image size="16" resid="Contoso.Réinit_16x16" />
      <bt:Image size="20" resid="Contoso.Réinit_20x20" />
      <bt:Image size="24" resid="Contoso.Réinit_24x24" />
      <bt:Image size="32" resid="Contoso.Réinit_32x32" />
      <bt:Image size="40" resid="Contoso.Réinit_40x40" />
      <bt:Image size="80" resid="Contoso.Réinit_80x80" />
    </Icon>
    <Action xsi:type="ExecuteFunction">
      <FunctionName>action3</FunctionName>
    </Action>
    <Enabled>false</Enabled>
</Control>

默认情况下,Office 应用程序启动时会启用任何加载项命令。如果您希望在 Office 应用程序启动时禁用自定义按钮或菜单项,请在清单中指定。只需在控件声明中的元素下方(而不是内部)添加一个Enabled元素(带有 value )。falseAction

在启用和禁用加载项命令一文中了解更多信息。


推荐阅读