如何使用 xml 在 Excel 中实现此自定义功能区组布局
How can I achieve this custom ribbon group layout in Excel using xml
我正在 Excel 中的新功能区组上创建自定义按钮组,以便在我将 VBA 宏分发到我公司的部门时使用。为了实现这一点,我一直在网上四处寻找,试图首先使用像 here until I found out that they're not the way to go when you're using later versions of Excel (I'm using 2010). So, after being pointed in the correct direction by a question on SO I've started working with xml
and it seems pretty straightforward. I took the example from here and combined it with one of the user's comments on the CustomUIEditor download page here 这样的 Button 对象,现在有了下面的 xml
代码的简单框架,我将使用它来创建我的自定义选项卡(图片是不同图片的占位符):
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" >
<ribbon startFromScratch="false" >
<tabs>
<tab id="CustomTab" label="Alfred" >
<group id="ESPAssistant" label="ESP Assistant">
<button id="Alfred" size="large" label="Alfred" imageMso="HappyFace"/>
<button id="Doc" label="Documentation"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
这给了我:
到目前为止一切都很好。但是,我想看看是否有一种方法可以让一个 large/medium 按钮顶部有一个图像,图像下方有文本,然后在较大的按钮下方放置较小的按钮(在本例中为文档)。像这样:
我一直在浏览 msdn 文档页面(我发誓这就像在那些页面上玩蛙跳游戏,直到你最终找到你真正想要的东西)直到我找到 this page,这似乎是像是一个看似合理的解决方案,但我似乎无法让它发挥作用。
所以,我的问题:
- 我的想法可以使用
xml
实现吗?
- 如果是这样,你能帮我提供一个代码片段,或者至少为我指出正确的方向,让我知道如何完成这个吗?
- 如果不可能,那么您建议我怎么做才能至少模仿接近这种布局的东西?
看来这实际上是不可能实现的,因为 Excel 框架强制执行的 MSDN Article points out that the ScalingPolicy and SizeDefinitions 不允许不一致,即使使用他们的 UI 自定义.叹息
我正在 Excel 中的新功能区组上创建自定义按钮组,以便在我将 VBA 宏分发到我公司的部门时使用。为了实现这一点,我一直在网上四处寻找,试图首先使用像 here until I found out that they're not the way to go when you're using later versions of Excel (I'm using 2010). So, after being pointed in the correct direction by a question on SO I've started working with xml
and it seems pretty straightforward. I took the example from here and combined it with one of the user's comments on the CustomUIEditor download page here 这样的 Button 对象,现在有了下面的 xml
代码的简单框架,我将使用它来创建我的自定义选项卡(图片是不同图片的占位符):
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" >
<ribbon startFromScratch="false" >
<tabs>
<tab id="CustomTab" label="Alfred" >
<group id="ESPAssistant" label="ESP Assistant">
<button id="Alfred" size="large" label="Alfred" imageMso="HappyFace"/>
<button id="Doc" label="Documentation"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
这给了我:
到目前为止一切都很好。但是,我想看看是否有一种方法可以让一个 large/medium 按钮顶部有一个图像,图像下方有文本,然后在较大的按钮下方放置较小的按钮(在本例中为文档)。像这样:
我一直在浏览 msdn 文档页面(我发誓这就像在那些页面上玩蛙跳游戏,直到你最终找到你真正想要的东西)直到我找到 this page,这似乎是像是一个看似合理的解决方案,但我似乎无法让它发挥作用。
所以,我的问题:
- 我的想法可以使用
xml
实现吗?- 如果是这样,你能帮我提供一个代码片段,或者至少为我指出正确的方向,让我知道如何完成这个吗?
- 如果不可能,那么您建议我怎么做才能至少模仿接近这种布局的东西?
看来这实际上是不可能实现的,因为 Excel 框架强制执行的 MSDN Article points out that the ScalingPolicy and SizeDefinitions 不允许不一致,即使使用他们的 UI 自定义.叹息