Jumpy73
Jumpy73

Reputation: 105

Inserting "&" symbol into Label property of Office Ribbon XML controls

I am building a ribbon tab for MS Excel 2016 from scratch using XML stored within a customUI14.xml file. I created buttons having the "&" special character into the button label (i.e. "Cut & Paste", or "Trades & Models", etc...). The code for inserting the symbol works fine, but I cannot get the labels of the XML controls to display this symbol.

I used both the methods described in the post Inserting symbols into Office Ribbon XML controls but nothing seemed to work.

I'm not state that those approaches don't work at all (I tried with other symbols and they worked - i.e. with the same symbol "€" of the above mentioned post the solution provided in the past post works well)

<menu id="T1G2M1-PGSTRGY" getLabel="RibSetCtlLabel" size="normal" itemSize="normal" 
imageMso="ChartInsertGalleryNew" screentip="Settings &amp; Filters" 
supertip="Options to use during What-If Analysis." getEnabled="RibSetCtlEnabled">

with this call-back procedure

Public Function RibSetCtlLabel(ctl As IRibbonControl, ByRef Label)
  Label = "Settings " & Chr(38) & " Filters"
End Function

Both approaches ("&" symbol directly into the xml text or into the string applyed as result of the call-back procedure) fail tu run properly

I expected to have the button label = "Settings & Filters" but "Settings Filters" is displayed

The workaround solution is required to be run both on x32 and x64 Office 2016 version

Upvotes: 1

Views: 1309

Answers (2)

Dominikus
Dominikus

Reputation: 21

In the XML use:

&amp;&amp;

Upvotes: 2

Eugene Astafiev
Eugene Astafiev

Reputation: 49395

You need to duplicate a special character in the string to get it visible on the ribbon UI. For example:

Ribbon && Fluent UI

Upvotes: 1

Related Questions