How can a checkbox on the ribbon be checked by default?
There does not appear to be an attribute mentioned on MSDN.
Can it be done with JavaScript?
I have a checkbox on the queue view, which while checked should keep the queue auto refreshing:
<CustomAction Id="Mscrm.HomepageGrid.queueitem.MainTab.Workflow.Controls.CustomAction" Location="Mscrm.HomepageGrid.queueitem.MainTab.Management.Controls._children" Sequence="60">
<CommandUIDefinition>
<CheckBox Id="Mscrm.HomepageGrid.queueitem.MainTab.Workflow.Controls.CheckBox" LabelText="Auto Refresh" TemplateAlias="o3" ToolTipTitle="Queue Auto Refresh" ToolTipDescription="Periodically auto refresh this queue" Command="Mscrm.HomepageGrid.queueitem.MainTab.Workflow.Controls.Command" Sequence="60" />
</CommandUIDefinition>
</CustomAction>
The auto-refresh is working fine and is on by default.
I'm not certain but I believe the Microsoft Ribbon between application is fairly similar.
So you could try; CheckBox element: ApplicationDefaults.IsChecked
This is total guess in all honesty
Related
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
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)
I added a custom action to SharePoint list. In CommandUIHandler in EnableScript attribute I added a javascript function. Then I realised that it is being invoked twice. To be more specific:
1) When I enter a default view for the list and click "Items" in a Ribbon it is invoked once
2) When I select checkbox near the list item it is invoked twice?
I have some queries loading in a background so I don't want it to be called twice. Does anyone know whether it's a bug or SharePoint default behaviour?
<CustomAction
Id="Ribbon.Documents.TestGroup.AssignCard"
Location="CommandUI.Ribbon"
RegistrationId="10001"
RegistrationType="List"
ShowInLists="TRUE"
Sequence="26">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.ListItem.Actions.Controls._children">
<Button
Id="Ribbon.Documents.TestGroup.AssignCard"
LabelText="Assign"
ToolTipTitle="Assign a free card"
ToolTipDescription="Opens a form to assign a free card to a guest."
Alt="Assign"
Sequence="31"
Command="AssignButtonCommand"
Image32by32="/_layouts/1033/images/formatmap32x32.png"
Image32by32Top="-160"
Image32by32Left="-288"
TemplateAlias="o1" />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="AssignButtonCommand"
CommandAction="javascript: document.ReceptionRibbon.AssignButton({SiteUrl}, {SelectedItemId});"
EnabledScript="javascript: console.log('1'); document.ReceptionRibbon.EnableAssignButton();" />
</CommandUIHandlers>
</CommandUIExtension>
I managed to solve the issue by setting a temporary boolean variable to false when query starts, and setting it back to true when it ends.
I have a button which should open a web form from my project in a modal window. How can I achieve that with the devexpress popup control?
Use the Popup Control - Content URL to show another webform in the control. open popup on the button's client click event.
example:
<dx:ASPxPopupControl ID="popup" runat="server" ContentUrl="~/ContentPageWithTextBox.aspx"
Top="100" ClientInstanceName="clientPopup" CloseAction="CloseButton">
<ClientSideEvents Shown="OnShown" />
</dx:ASPxPopupControl>
Check this search Result
Reference:
How to manipulate client-side objects within a ASPxPopupControl with the specified ContentUrl - check example also.
Hope this help...
Here is sample code:
<input id="openBtn" type="button" value="Open popup"
onclick="myPopup.SetContentUrl('http://www.google.com');myPopup.Show();" />
<dx:ASPxPopupControl runat="server" ClientInstanceName="myPopup" Modal="True"
CloseAction="CloseButton" Width="500px" Height="400px"/>
ASPxClientPopupControl members
ASPxPopupControl members
See ASPxPopupControl Online Demos and the Code Central Examples to learn more on how accomplish this task.
How can I target custom ribbon action menus for specific list views? I want to be displayed in the default view of the list but to be hidden in the other views.
Any ideas?
Though the question is old, yet unanswered , I am responding to it.
Create an empty Sharepoint Project in VS2010 , add an Elements.xml file in the project and past following XML in it.
<CustomAction Id="MyCustomButton" Sequence="999"
GroupId="Manage"
Location="CommandUI.Ribbon" // Location to display button
RegistrationId="101" // on every list, for a specific list or library put the GUID of list here e.g. RegistrationId="{GUID_OF_LIST}"
RegistrationType="List"
Rights="ManageWebs"
Title="Custom Document Library Button">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Documents.Manage.Controls._children">
<Button Id="Ribbon.Documents.Manage.Controls.CustomButton" TemplateAlias="o1"
ToolTipDescription="Creates a server side action."
ToolTipTitle="SSRibbon" LabelText="SS Action"
Image32by32="/_layouts/images/ContractClaims/newproject.jpg"
Image16by16="/_layouts/images/ContractClaims/newproject.jpg" Alt="New Project"
Command="{3E04C0C1-12DD-449E-905F-7E88EB9E22B1}"
Sequence="20"/>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="{3E04C0C1-12DD-449E-905F-7E88EB9E22B1}"
CommandAction="javascript:alert ('Hello World' ) ;" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
The several locations to display the button can be found here.For more on the top you can google respective XML elements.
You can use EnabledScript parameter in CommandUIHandler, where you can put javascript code and check if specific page/list/view is loaded.
link to similar answer
Example:
<CommandUIHandler
Command="Ribbon.ListItem.CustomGroup.Controls.BtnSayHello.Command"
CommandAction="javascript:alert('Hello');"
EnabledScript="javascript:
function isEnable(){
if(location.href.indexOf('AllItems.aspx') > 0){
return true;
}
return false;
}
isEnable();"
/>