Inserting symbols into Office Ribbon XML controls

南楼画角 提交于 2019-12-11 03:49:13

问题


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.


回答1:


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


来源:https://stackoverflow.com/questions/8451331/inserting-symbols-into-office-ribbon-xml-controls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!