none
Subheadings in dropdown gallery RRS feed

  • Question

  • I am writing an add-in for Word 2010 and trying to add a dropdrown gallery to a tab which is similar to the shapes gallery.

    I want my gallery to have multiple sections (much like the shapes gallery in MS Word), however, I am having trouble finding any documentation or examples. Wondering if this is even possible and if so how I would go about creating multiple sections.

    Thanks.

    Thursday, May 26, 2011 2:53 PM

Answers

  • Hi Gerald

    After posting the reply I've been looking this over more and I don’t find an official way to do what you are asking. Maybe there is and Cindy or other might know.

    However, you could potentially “hack” a method by following the examples described in the link I provided, particularly about using variable names for item height and width and then based on the item id, insert your “sub header” as an image object in the appropriate row of the gallery and suppress showing other items in that row.

    The following XML will show “conceptually” what I’m trying to describe.  The second row of the gallery would output a single image, again that image would be your sub heading.

            <group id="TestGroup" label="My Gallery">

              <gallery id="ClkGal1" label="MyImages" imageMso="HeaderFooterPictureInsert"

                  screentip="Hope this works" onAction="ClkItemIcon" columns="2" rows="3"

                  itemHeight="32" itemWidth="32" size="large" showItemLabel="false" >

                <item id="itm1" imageMso="FileNew" label="Item 1" screentip="My item 1" />

                <item id="itm2" imageMso="FileNew" label="Item 2" screentip="My item 2" />

                <item id="itm3" imageMso="FileOpen" label="Blank Row" screentip="My item 3" />

                <item id="itm4" label="Blank Row" screentip="My item 4"/>

                <item id="itm5" imageMso="FileNew" label="Item 5" screentip="My item 5" />

                <item id="itm6" imageMso="FileNew" label="Item 6" screentip="My item 6" />

              </gallery>

            </group>


    Kind Regards, Rich ... http://greatcirclelearning.com
    • Proposed as answer by Bruce Song Tuesday, June 7, 2011 1:02 PM
    • Marked as answer by Bruce Song Tuesday, June 7, 2011 1:02 PM
    Thursday, May 26, 2011 5:17 PM
  • Simple Source ...

    Hope this helps..(VS2008 , Word2007)

        private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
        {
          //1.
          this.dropDown1.Items.Add(new RibbonDropDownItem()
          {
            Label = "test",
            Image = System.Drawing.Image.FromFile(@"C:\Users\Jun\Pictures\folder.gif")
          }); 
          
          //2.
          for (int i = 1; i < 3; i++)
          {
            RibbonDropDownItem item = new RibbonDropDownItem();
            item.Label = "test" + i;
            item.Image = System.Drawing.Image.FromFile(@"C:\Users\Jun\Pictures\folder.gif");
            this.dropDown1.Items.Add(item);
          }
        }
    

     


    http://vsto.tistory.com
    Thursday, May 26, 2011 11:25 PM

All replies

  • Hi Gerald,

    Did you look at this article?

    http://msdn.microsoft.com/en-us/library/bb736142(v=office.12).aspx


    Kind Regards, Rich ... http://greatcirclelearning.com
    Thursday, May 26, 2011 3:46 PM
  • Hey Rich,

    I have read the article and unfortunately it doesn't answer my question of inserting subheadings into the gallery. I have no problem making my own custom gallery, but I really want those subheadings and can't get them.

    I figure that I can do it because the shapes gallery can do it. Actually, I can't even get a heading let alone subheadings for my custom gallery and there are several other built-in galleries with headings. However, I can't find an example of an custom gallery with a heading making me believe it might not be possible?

    Since, the headings in the built-in galleries have the same style as the menuSeparator, it makes me believe these built-in galleries (such as the shapes) are actually a combination of menus and galleries and that the galleries are being displayed in some special way (much like the in-ribbon galleries are) as opposed to just dropdown gallery.

    Gerald

     

    Thursday, May 26, 2011 4:17 PM
  • Hi Gerald

    After posting the reply I've been looking this over more and I don’t find an official way to do what you are asking. Maybe there is and Cindy or other might know.

    However, you could potentially “hack” a method by following the examples described in the link I provided, particularly about using variable names for item height and width and then based on the item id, insert your “sub header” as an image object in the appropriate row of the gallery and suppress showing other items in that row.

    The following XML will show “conceptually” what I’m trying to describe.  The second row of the gallery would output a single image, again that image would be your sub heading.

            <group id="TestGroup" label="My Gallery">

              <gallery id="ClkGal1" label="MyImages" imageMso="HeaderFooterPictureInsert"

                  screentip="Hope this works" onAction="ClkItemIcon" columns="2" rows="3"

                  itemHeight="32" itemWidth="32" size="large" showItemLabel="false" >

                <item id="itm1" imageMso="FileNew" label="Item 1" screentip="My item 1" />

                <item id="itm2" imageMso="FileNew" label="Item 2" screentip="My item 2" />

                <item id="itm3" imageMso="FileOpen" label="Blank Row" screentip="My item 3" />

                <item id="itm4" label="Blank Row" screentip="My item 4"/>

                <item id="itm5" imageMso="FileNew" label="Item 5" screentip="My item 5" />

                <item id="itm6" imageMso="FileNew" label="Item 6" screentip="My item 6" />

              </gallery>

            </group>


    Kind Regards, Rich ... http://greatcirclelearning.com
    • Proposed as answer by Bruce Song Tuesday, June 7, 2011 1:02 PM
    • Marked as answer by Bruce Song Tuesday, June 7, 2011 1:02 PM
    Thursday, May 26, 2011 5:17 PM
  • Thanks for the tip, I will play around with the hack and see what I can get until I get a more official answer.

     

    Gerald

    Thursday, May 26, 2011 5:56 PM
  • Another option is to use a custom task pane and you can format it.

    http://msdn.microsoft.com/en-us/library/aa942846.aspx


    Kind Regards, Rich ... http://greatcirclelearning.com
    Thursday, May 26, 2011 6:25 PM
  • Simple Source ...

    Hope this helps..(VS2008 , Word2007)

        private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
        {
          //1.
          this.dropDown1.Items.Add(new RibbonDropDownItem()
          {
            Label = "test",
            Image = System.Drawing.Image.FromFile(@"C:\Users\Jun\Pictures\folder.gif")
          }); 
          
          //2.
          for (int i = 1; i < 3; i++)
          {
            RibbonDropDownItem item = new RibbonDropDownItem();
            item.Label = "test" + i;
            item.Image = System.Drawing.Image.FromFile(@"C:\Users\Jun\Pictures\folder.gif");
            this.dropDown1.Items.Add(item);
          }
        }
    

     


    http://vsto.tistory.com
    Thursday, May 26, 2011 11:25 PM