joeschwa
joeschwa

Reputation: 3175

Inserting symbols into Office Ribbon XML controls

I am building a ribbon tab for Word 2010 from scratch using XML stored within a Word template's customUI14.xml file. I am creating buttons that when clicked insert the text for various symbols (the euro, section mark, etc.) The code for inserting the symbols works fine, but I cannot get the labels of the XML controls to display these symbols. For example, I tried this to display a euro symbol:

 <group id="rxGroupSymbols" label="Symbols">
      <button id="rxbtnEuro" label="&#128;" size="normal" onAction="rxshared_click">
 </button>
 </group>

But when using ASCII symbol equivalents the "&#128;" does not generate the euro symbol, nor do other variations such as &amp;#128;.

How can I get the Ribbon XML to display these characters on Office ribbon controls? Thanks.

Upvotes: 2

Views: 2559

Answers (1)

joeschwa
joeschwa

Reputation: 3175

It turns out that XML allows only five special characters (character entities) as detailed in this Wikipedia entry. The solution was to use the getLabel attribute:

 <group id="rxGroupSymbols" label="Symbols">
      <button id="rxbtnEuro" getLabel="getlabel" size="normal" onAction="rxshared_click">
      </button>
 </group>

And send the ASCII symbol into the XML as a string:

 Public Function getlabel(control As IRibbonControl, ByRef Label)
      Label = Chr(128)
 End Function

Upvotes: 2

Related Questions