MS Office Excel 功能区 - 无法更改/隐藏“主页”选项卡中的编辑组

发布于 2024-08-12 19:54:16 字数 966 浏览 2 评论 0原文

我有一个 Excel 的 .net 插件。该插件为 Excel 2007 创建功能区 UI,并重新调整一些现有命令的用途,例如剪切、复制、粘贴、排序等。

对于剪切、复制和粘贴,我只是覆盖它们的 OnAction 值,以便在单击按钮时调用我自己的过程。但对于 Sort、Sort Asc 和 Sort DES 命令,情况略有不同。当单击“排序”、“升序排序”或“降序排序”按钮时,我希望收到通知,然后调用默认功能。在 Excel 2003 命令栏中,可以通过调用 CommandBarControl 上的 Execute() 方法来实现这一点。

在 Excel 2007 中,有一个 ExecuteMso() 方法可以通过编程方式单击功能区元素,但是当重写 OnAction 时,此 ExecuteMso() 方法仅执行我自己的过程,而不是该按钮的默认功能。

所以我想我应该隐藏“主页”选项卡中“编辑”组中的排序按钮,并向其中添加我自己的排序、升序排序和降序排序按钮。这些按钮将首先调用我的程序,我将在其中调用默认行为。

现在的问题是我无法更改/隐藏编辑组(idMso =“GroupEditing”)。这个内置组是不可编辑的吗?不过,我可以隐藏剪贴板和其他组(但无法向它们添加按钮)。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
  <ribbon>
    <tabs>
      <tab idMso="TabHome">        
        <group idMso="GroupEditing" visible="false" />
      </tab>
    </tabs>
  </ribbon>
</customUI>

I have a .net addin for Excel. The addin creates the Ribbon UI for Excel 2007 and re-purposes some existing commands such as Cut, Copy, Paste, Sort etc.

For Cut, Copy and Paste I am just overriding their OnAction value to call my own procedure when the buttons are clicked. But for Sort, Sort Asc and Sort Desc commands the case is a little different. When either of the Sort, Sort Asc or Sort Desc buttons are clicked, I want to get notified and then call the default functionality. This was possible in Excel 2003 commandsbars by calling the Execute() method on the CommandBarControl.

In Excel 2007, there is a ExecuteMso() method to programmatically click a ribbon element but when the OnAction is overridden, this ExecuteMso() method just executes my own procedure and not the default functionality of that button.

So I thought that I will HIDE the Sort buttons in the "Editing" group in Home tab and add my own Sort, Sort Asc and Sort Desc buttons to it. The buttons will call into my procedure first from where I will call the default behavior.

Now the problem is that I am unable to change/hide the Editing group (idMso="GroupEditing"). Is this built-in group not editable? I can however HIDE the Clipboard and other groups(but can't add buttons to them).

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
  <ribbon>
    <tabs>
      <tab idMso="TabHome">        
        <group idMso="GroupEditing" visible="false" />
      </tab>
    </tabs>
  </ribbon>
</customUI>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

长途伴 2024-08-19 19:54:16

我认为 idMso 在隐藏编辑组方面是不正确的。

idMso="GroupEditingExcel"

I think the idMso is incorrect in relation to hiding the Editing group.

idMso="GroupEditingExcel"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文