Question

I am not able to properly align the controls in a group in custom ribbon in Word 2007. Bad control alignment

In the above screenshot you can notice the textboxes and the dropdowns are not properly aligned. Following is my CustomUI ribbon XML:-

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="RibbonLoad">
<ribbon>
<tabs>
<tab id="tabZZZZ" label="ZZZZ">
<group id="grpItems" label="Items">
<dropDown id="ddlQQQ"  getItemLabel="qqqq" onAction="rrrr"  label="zzzz zzzzz">
<item id="item1" label="item1"/>
</dropDown>
<editBox id="editAAA1" label="AAAAA AAAAA AAAAA" onChange="ZZZ" />
<editBox  id="editBBBB" label="BBBB BBBBB BBBBB BBBBB" onChange="BBB" />
<separator id="separator1" />
<editBox id="editCCCC" label="CCCCCC CC CCCCCC CCCC" onChange="CCC" />
<dropDown id="ddlDDD" label="DDDDDDD DDDD DDDDDDDD DDDD" onAction="DDD" getItemLabel="DDD">
<item id="Item1" label="Item1"/>
</dropDown>
<button id="btnEEE" label="EEEEEEEEEEEEEE" onAction="EEEE"/>
</group>                    
</tab>
</tabs>
</ribbon>
</customUI>

My apologies for such weird names for labels. However, the number of characters in each label in the above XML is same that for the actual labels I am using. Could anyone please advice?

Was it helpful?

Solution

This is by-design, the design surface doesn't support multi-component layout like Access. To achieve what you're looking for, try this instead:

<group id="Group1" label="Group1">
    <labelControl id="ddlQQQ" label="zzzz zzzzz" />
    <labelControl id="editAAA1" label="AAAAA AAAAA AAAAA" />
    <labelControl id="editBBBB" label="BBBB BBBBB BBBBB BBBBB" />
    <dropDown id="ddlQQQDropDown" label="DropDown1" showLabel="false" showImage="false" />
    <editBox id="editAAA1EditBox" label="EditBox1" showLabel="false" showImage="false" />
    <editBox id="editBBBBEditBox" label="EditBox2" showLabel="false" showImage="false" />
</group>

As a side note, you may want to set the SizeString on your dropdown and/or edit boxes to ensure uniform width across them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top