2

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.

braX
  • 11,506
  • 5
  • 20
  • 33
joeschwa
  • 3,083
  • 1
  • 21
  • 41
  • Hey, I just want to do the same thing, I need a button in my ribbon to insert some symbols, can you give more details how to achieve that? – Pedro77 Aug 06 '15 at 13:57
  • @Pedro77 -- If Google and SO don't already have this answer (or the answers don't make much sense), post a question that shows the code you've tried and the specific symbols you are trying to insert via your ribbon control. – joeschwa Aug 06 '15 at 16:09

1 Answers1

2

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
joeschwa
  • 3,083
  • 1
  • 21
  • 41