Add standard command button "New Slide" to custom ribbon in office add-in
Asked Answered
P

5

0

I have created my customized ribbon in an addIn. Now I would like to add the New Slide command that exist in home screen (see screenshot below).

Original Powerpoint ribbon

Permatron answered 23/2, 2015 at 12:9 Comment(4)
if you want to customize ribbon for PowerPoint You can create AddIn Project for PowerPoint.Chesson
@ShariqueAnsari: I have created an addin I want to call this new slide that is on home page to my Add in ribbon that is created . i want to use this feature in my add in so users wont have to move back and forth to other ribbons. with additional features givenPermatron
new slide that is on home page?? Can u share your code it will help us to understand better.Chesson
You can add to quick access toolbar by right clicking on that button,it will be more easy why you want to add it in menu?Chesson
J
1

You can add built-in controls to your custom tab by soecifying their IdMso values. See Office 2013 Help Files: Office Fluent User Interface Control Identifiers .

You can read more about the Ribbon UI in the following series of articles in MSDN:

Jewelry answered 23/2, 2015 at 12:33 Comment(0)
R
1

I think after a lot of searching I finally figured it out! This is all the code you need, delete everything else This will create a new slide button just like the one that comes default in PowerPoint

<group id="add_slide" label="Add Slide">
  <control idMso="SlideNewGallery" size="large" />
</group>

credit

Rillings answered 25/1, 2021 at 22:47 Comment(0)
P
0

i currently have new slide button in my addin like the image below which gives me a new slideenter image description here

however I want the option like the already existing new slide in home ribbon where I can choose templates.Is there any way to invoke this button in my customized ribbon so below is my newslide that is what i want to get in my addin

enter image description here

  private void New_slide_Click(object sender, RibbonControlEventArgs e)
    {

        PowerPoint.Application ppApp = Globals.ThisAddIn.Application;
        ppApp.CommandBars.ExecuteMso("SlideNewGallery");
    }
Permatron answered 26/2, 2015 at 6:16 Comment(3)
As I wrote above, you need to find the built-in control ID in the Office 2013 Help Files: Office Fluent User Interface Control Identifiers and specify it for the idMso property of the custom control.Jewelry
check the above edited answer i have added execute mso to new slide button. But it just adds new slide. i want even drop down option like shownin img 2Permatron
Maybe this shall not be a comment but updated in the question?Disproportionate
P
0

I created a new ribbon based on xml Template in VS. Afterwards I added a group and a control based on an idMso-Value. When using this xml file

<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
  <ribbon>
    <tabs>
      <tab id="tab0" label="AddIn">
        <group id="grpCustom">
          <button idMso="SlideNew" size="large" label="YOUR CUSTOM TEXT"></button>
        </group>
        <group idMso="GroupSlides"></group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

This results in that custom ribbon. Eugene Astafiev pointed it out, you can find idMso-Values in MSDN.

customized ribbon controls

Polly answered 26/2, 2015 at 19:46 Comment(4)
i am using designer so i added a button .. gave OfficeImageid as idmso so this creates an image of button juzt like it exists in home . and also on execute when i give this query private void New_slide_Click(object sender, RibbonControlEventArgs e) { PowerPoint.Application ppApp = Globals.ThisAddIn.Application; ppApp.CommandBars.ExecuteMso("SlideNewGallery"); } it works great.My problem is the dropdown option in new slide to select template like it is shown in 2nd image of my 2nd answer is what i want.Permatron
There is a good article about Understanding Custom Layouts on mvps.org. You can find there how to get the current available layouts. Unfortunatelly I failed on adding them dynamically to a splitButton....Polly
Somehow the code and the screenshot do not like consistent? I can not see the code for the button "Neue Folie"Disproportionate
Using idMso is the right solution. Thanks! I like to use the Ribbon Editor to edit the ribbon andypope.info/vba/ribboneditor.htmDisproportionate
D
0

As explained by Franz the solution is to use the idMso. For the New Slide command you are looking for, if you look at MSN in the idMso Table for "New Slide" you will find two entries. The one you are looking for is a Gallery with idMso=SlideNewGallery. (not a button). You can add it in the XML. I like to use the Ribbon Editor. With the Ribbon Editor it looks like this: Ribbon Editor: Add idMso command

And in the Add-In it looks then like this: AddIn Ribbon with standard command

The CustomUI XML relevant part looks like this

<group id="TD_GrpMisc" label="Misc">            
        <gallery 
            idMso="SlideNewGallery"
            size="large"/>
        <button 
            idMso="SlideNew"
            size="large"/>
</group >
Disproportionate answered 21/9, 2016 at 11:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.