在组标签名称中使用“&"符号在Word 2010中开发功能区选项卡 [英] Developing a ribbon tab in Word 2010, using ampersand symbol in group label name

查看:117
本文介绍了在组标签名称中使用“&"符号在Word 2010中开发功能区选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发功能区选项卡,以用于Word 2010的模板(MyTemplate.dotm).

I'm developing a ribbon tab for use in a template (MyTemplate.dotm) for Word 2010.

我的问题:我想在一个组的标签中有一个&符号(&).我已经尝试了很多事情,并且在这个问题上进行了大量的搜索,但是没有任何效果:

My problem: I want to have an ampersand symbol (&) in the label for a group. I have tried many things, and also alot of googling about this issue, but nothing works:

(named)   &
(decimal) &
(decimal) &
(hex)     &

这是我尝试过的,xml保存在MyTemplate.dotm文件中(使用用于Microsoft Office的自定义UI编辑器):

This is what I have tried, the xml saved in MyTemplate.dotm-file (with Custom UI Editor for Microsoft Office):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
  <ribbon>
    <tabs>
      <tab id="tabMyTemplate" label="myTemplate">

        <group id="grpCopyAndPasteCopy1" label="Copy&amp;Paste 1">
        <!-- HTML Entity (named) &amp; -->
        </group>
        <group id="grpCopyAndPasteCopy2" label="Copy&#38;Paste 2">
        <!-- HTML Entity (decimal) &#38; -->
        </group>
        <group id="grpCopyAndPasteCopy3" label="Copy&#038;Paste 3">
        <!-- HTML Entity (decimal) &#038; -->
        </group>
        <group id="grpCopyAndPasteCopy4" label="Copy&#x26;Paste 4">
        <!-- HTML Entity (hex) &#x26; -->
        </group>

      </tab>
    </tabs>
  </ribbon>
</customUI>

在Word 2010中打开MyTemplate.dotm时,结果如下:

Here is the result when open MyTemplate.dotm in Word 2010:

有人知道我应该如何解决这个问题吗?

Does anyone know how I should solve this problem?

推荐答案

使用标准菜单项时,这是一个常见问题.单个与号(&)被解释为快捷键(在按住Alt键时带有下划线的快捷键).

This is a common problem when working with standard menu items. A single ampersand (&) is interpreted as the shortcut key (the one that gets underlined when you hold down the Alt key).

显示文字'&'在标题中,将它们加倍:Copy&&Paste.我不确定是否需要转义它们(如果这样做,请使用&amp;&amp;,但是双倍字符应该可以为您提供所需的输出.

To show a literal '&' in the caption, double them: Copy&&Paste. I'm not sure if you'll need to escape them or not (if you do, use &amp;&amp;, but the doubled characters should give you the output you want.

这篇关于在组标签名称中使用“&"符号在Word 2010中开发功能区选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆