Excel 2007 Ribbon splitbutton with submenu - excel

I've got a simple split button in my Ribbon. And under it I have two buttons in the menu.
It works well.
Now I want to extend the first button -button id="rxBtn_CreateDataFiles" - into more options,
and have another submenu extend to the right with two more choices.
What would be the syntax for it? Thanks.
<splitButton id="rxspb_CreateDataFiles" size="normal">
<button id="rxBtn_CreateDataFilesFace" label="Data Files" imageMso="ChartEditDataSource"/>
<menu id="rxmnuCreateDataFiles">
<button id="rxBtn_CreateDataFiles" label="Run EQ" onAction="QRCreateDataFiles_Click" imageMso="ExportExcel"/>
<button id="rxBtn_CreateSpecificDataFiles" label="Run Select EQ" onAction="QRCreateDataFilesForSpecific_Click" imageMso="ExportExcel"/>
</menu>
</splitButton >

I figured it out. Just need to insert another menu section in the middle. Thanks.

Here is what I would do: Create the buttons in VBA using Ribbon Commander and then export XML to a static Ribbon using .serializeToXML
With rxCustomUI.defaultInstance
With .ribbon.tabs.Add(New rxTab)
.Label = "tab"

Related

Default PXRichTextEdit to Plain Text

When viewing a PXRichTextEdit field in Acumatica, there is a dropdown at the top left of the control to change from Visual to Plain Text. Is there any way to have that control automatically default to the Plain Text option for new records?
I did not find any property to do so.
The only property targeting this menu is AllowSourceMode which can hide the HTML menu item:
<px:PXRichTextEdit ID="edDescription" runat="server" DataField="Description"
AllowSourceMode="False">

Custom ribbon tab disappears in second launch

I created a basic custom Excel ribbon tab with 5 buttons. When I edit the custom ribbon (using Office RibbonX Editor) everything works fine when I launch the Excel file for the first time after the ribbon edit.
But the problem is when I close my Excel file and I want to reopen it again (for the second time), there's no single sign my custom ribbon tab ever existed. My custom tab keeps disappearing. When I open Office RibbonX Editor again, the XML file is also empty. Is this problem fixable? I want to be able to close my Excel file, open it again, and use my custom ribbon as many times as I want.
Here is the XML code of my custom tab:
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon startFromScratch="false">
<tabs>
<tab id="voetbalOpstellingTab" label="Voetbalopstelling" insertBeforeMso="TabHome">
<group id="openMainWindowGroup" label="Home">
<button id="openMainWindow" image="home" size="large"
label="Open het hoofdscherm" description="Open het hoofdscherm"
screentip="Open het hoofdscherm"
onAction="ribbonTab.openMainWindow"/>
</group>
<group id="viewGroup" label="Weergeven">
<button id="openPlayersSheet" image="group" size="large"
label="Spelers weergeven" description="Geef de spelers weer"
screentip="Geef de spelers weer"
onAction="ribbonTab.openPlayersSheet"/>
<button id="openWedstrijdSheet" image="dashboard" size="large"
label="Overzicht weergeven" description="Geef het overzicht van wie, waar tijdens welke wissel heeft gespeeld weer"
screentip="Geef het overzicht van wie, waar tijdens welke wissel heeft gespeeld weer"
onAction="ribbonTab.openWedstrijdSheet"/>
</group>
<group id="actionsGroup" label="Acties">
<button id="openAddPlayerWindow" image="add-user" size="large"
label="Speler toevoegen" description="Voeg een speler toe"
screentip="Voeg een speler toe"
onAction="ribbonTab.openAddPlayerWindow"/>
<button id="openRemovePlayerWindow" image="remove-user" size="large"
label="Speler verwijderen" description="Verwijder een speler"
screentip="Verwijder een speler"
onAction="ribbonTab.openRemovePlayerWindow"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Can someone please help me?
Thanks in advance!
You are referring to some built-in controls on the ribbon. Make sure all of them are available when Excel is open. Otherwise, your custom UI will not be created.
Do you get Ribbon UI errors when your custom UI disappears?
By default, if an add-in attempts to manipulate the Microsoft Office user interface (UI) and fails, no error message is displayed. However, you can configure Microsoft Office applications to display messages for errors that relate to the UI. You can use these messages to help determine why a custom ribbon does not appear, or why a ribbon appears but no controls appear.
To show VSTO Add-in user interface errors
1. Start the application.
2. Click the File tab.
3. Click Options.
4. In the categories pane, click Advanced.
In the details pane, select Show VSTO Add-in user interface errors, and then click OK.
A security update may have caused this. See this:
https://www.youtube.com/watch?v=AhnOU-ulqNg

Set transparent icon with RibbonX API in Excel not working

I am trying to set a transparent icon for my Excel add-in with the RibbonX API. This is my XML:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" loadImage="gui_LoadImage">
<ribbon>
<tabs>
<tab id="CBtab" label="2019CBMaster">
<group id="visualizationGroup" label="Visualization">
<button id="btnHistogram" label ="Press here" enabled="true" screentip="Press and see how magic happens" image="icn_btnHistogram.jpg" size="large"/>
</group>
<group id="NewGroup" label="2019NewGroup" >
<box id="bxBo">
<button id="btnNew" label="Press" image="icn_btnHisto.jpg" size="large"/>
<menu id="mnMenu" image="btn_img_random.jpg">
</menu>
</box>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
this is the sub that is setting the picture: for my testing purposes, it ignores the xml parameters and simply loads a 'fixed' picture:
Sub gui_LoadImage(ImageName As String, ByRef Image)
Set Image = stdole.LoadPicture("C:\Office 2010 Developer Resources\icons\gg.ico")
End Sub
I saved gg.ico in GIMP as 24 bpp and 1 bit alpha ico file. I also tried external ico-s and they did not display as well.
As you have understood from above, the icons are not displayed as if they were completely transparent.
Could you help?
Also, is this RibbonX API still supported? I am wondering because I have difficulties doing a pretty basic thing and can find little to no documentation. If not, what are the modern frameworks for developing Excel Add-ins with customizable ribbons?
Thank you.
Custom Ribbon UI icons can be transparent. I believe they must be .png files. Here are details on the UI Ribbon icon settings, which includes transparent backgrounds.
https://learn.microsoft.com/en-us/office/dev/add-ins/design/add-in-icons
REVISION
In custom UI editor, you can import your image files and then just reference the file names in the XML code. The file type and whether or not the image itself has a transparent background is what I believe determines whether or not it appears transparently on the ribbon. This is what the XML would look like. <button id="customButton1" label="Label 1" size="large" onAction="Macro1" image="picture1" /> 
In looking at your XML code, I see that you have the file extension included in with the images. I do not include the file extensions with my custom image icons. In the Custom UI editor that I linked, you can add import the image file, which appears in the side pane, then you reference only the file name in the XML (no file extension). I also believe is the file type itself and whether or not the image actually has a transparent background that determines whether or not it appears transparently in the ribbon. jpg files cannot be transparent, so that may be your problem right there. If your UI editor cannot accommodate PNG files, try using GIF. The icons are so small; image quality shouldn't be an issue.
Here is an example:
<splitButton id="splitButton2" size="large" >
<button id="InsertTools" label="Insert" image="InsertTools_Transparent" />
<menu id="menu2">
<button id="buttonInsertMultiSheets" onAction="ModRibbon.Run_InsertMultipleSheets" label="Insert Multiple Sheets" screentip="Add multiple worksheets at one time. An input box will appear for you to enter the number of sheets to be added." image="WorksheetAddMultipleSheets" />
</menu>
</splitButton>
Here are some of my personal notes from when I was learning that may or may not be helpful for you.
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<backstage>
<button id="MyCustomButton1" label="My Macro"
imageMso="HappyFace" isDefinitive="true" onAction="ModRibbon.Run_Macro1"/>
<!-- 'button id' each must be unique -->
<!-- 'My Macro' is the text that will appear on your button -->
<!-- Use 'imageMso' or 'image' to include a picture on your button. -->
<!-- 'imageMso' uses built-in Office images; do not insert into this file as icons. -->
<!-- 'image' uses your own image as your button's icon. Insert it into this file as an icon. -->
<!-- 'HappyFace' is the name of the built-in Office image (for custom images, enter the file name). -->
<!-- 'ModRibbon' is the name of the VBA module in which you will paste this call-back sub. You can name this anything. -->
<!-- 'Run_' is a custom prefix added to the macro name, so you don't have to rename your macros. -->
<!-- 'Macro1' is the macro that should be run when the button is clicked. -->
</backstage>
</customUI>
With the Custom UI editor I use, the callback would be:
'Callback for buttonInsertMultiSheets onAction
Sub Run_InsertMultipleSheets(control As IRibbonControl)
End Sub
From your code, it looks like you need a call to load the image as well, so the customUI control has two callbacks:
Sub LoadImage (imageID As String, ByRef image)
Sub OnLoad(ribbon As IRibbonUI)
If you also have a [Content_Types].xml, then the default type is PNG and you need to add a line at the very end of the file, but before , and then save your changes.
<Default Extension="jpg" ContentType="application/octet-stream"/>
The recommended file format for icons on the Ribbon UI is PNG. Microsoft Office Ribbons and toolbars support ICO, BMP and ICO files. So, I'd suggest converting your VBA macros to the COM add-in where you can easily load such images.
You may find the Graphics formats for Microsoft Office add-ins article helpful. The Fluent UI is described in depth in the following series of articles:
Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)

Position Action Buttons in Subform

Is there any way I can move action buttons from the main form of the page to a sub form on a page as shown in the following screen shot?
All actions will appear on main toolbar by default. You could hide them from there by using a < px: PXDSCallbackCommand Name="YOURACTIONNAME" Visible="False" CommitChanges="true" >< /px:PXDSCallbackCommand >. Then you could add your action to your Tab/Grid ActionBar. On AR303000-Customers you could see an example on Contacts Tab.

OpenERP creating sub menu's in custom module

So I have items for my custom module in my left menu bar, and I know how to order them:
menuitem id="*_id" name="*" parent="*" action="*_act_id" sequence="1"
My question is if it is possible to create sub menus.
Thank you for reading my question.
With kind regards,
To create sub menu you need to define new menu item in your xml file. for example,
This is your existing menu,
<menuitem id="menu_a_id" name="Menu A" parent="Some_parent" sequence="1" />
Now you need to add a another menu item with parent, Here the parent of the sub menu will be the Menu A,
<menuitem id="menu_B_id" name="Menu B" parent="menu_a_id" action="*_act_id" sequence="1" />
It will give you the parent-child(hierarchical) kind of menu item.
Add submenu to an existing menu to other module:
<menuitem id="name_you_want_must_be_unique" name="example"
parent="name_of_module_of_parent_menu.id_parent_menu_"
action="id_action_you_defineinxml_of_your_module" sequence=""/>

Resources