locked
Custom Icon on custom ribbon RRS feed

  • Question

  • i would like to insert my custom icon into my custom ribbon tools created in word 2007
    using vsto2005se

    how do i do that?

    i cant find the articles to do just that...

    and those article that talk about it dosent really reflect the actual stuff
    they tell me to add reference which is not there
    like this article
    http://blogs.msdn.com/frice/archive/2006/06/28/606466.aspx
    (ask me to add reference to Microsoft.Office.Interop.Word which is not there and it is for shared add-in project but i'm on word add-in)

    isn't there a simpler way to do so in Ribbon1.xml just add tag something like <image src="balba\bla\bal\123.jpg" or getImage="abc.jpg" or something simpler?

    My company are trying to incoporate word 2007 into our product but if we cant even change the HappyFace to something else, what good will vsto do?

    thanx in advance





    Friday, December 8, 2006 4:39 AM

Answers

  • Hi Laiseng

    I believe I've told you before that this isn't the best place to ask questions about working with the Ribbon. The Ribbon isn't specific to VSTO, it's part of Office. VSTO just uses it the same as any other programming language would. Try asking in the officedev newsgroup.

    Friday, December 8, 2006 4:01 PM

All replies

  • Hi Laiseng

    I believe I've told you before that this isn't the best place to ask questions about working with the Ribbon. The Ribbon isn't specific to VSTO, it's part of Office. VSTO just uses it the same as any other programming language would. Try asking in the officedev newsgroup.

    Friday, December 8, 2006 4:01 PM
  • Please check articles below:

     

    Customizing the Office (2007) Ribbon User Interface for Developers

    http://msdn2.microsoft.com/en-us/library/aa338202.aspx

    http://msdn2.microsoft.com/en-us/library/aa338199.aspx

    http://msdn2.microsoft.com/en-us/library/aa722523.aspx

     

    Also, check this blog:

    http://blogs.msdn.com/jensenh/default.aspx

     

    Anyway, you should override the getImage callback.

    So in your ribbon xml file set getImage=”myGetImage” where myGetImage is your function which return IpictureDisp by using function GetImageFromFile below.

    Hope it helps a little.

     

    public class AxHost2 : AxHost

    {

        public AxHost2()

            : base(null)

        {

        }

        public new static IPictureDisp GetIPictureDispFromPicture(Image image)

        {

            return (IPictureDisp)AxHost.GetIPictureDispFromPicture(image);

        }

    }

     

     // Load picture from imageFileName and return IPictureDisp

    public IPictureDisp GetImageFromFile(string imageFileName)

    {

        try

        {

            if (!File.Exists(imageFileName))

                    return null;                       

           

            using (Bitmap bmp = new Bitmap(imageFileName))

            {

                if (bmp != null)

                    return (IPictureDisp)AxHost2.GetIPictureDispFromPicture(bmp);

            }

        }

        catch (Exception ex)

        {

            MessageBox.Show(ex.StackTrace, ex.Message);

        }

        return null;

    }     

     

     

     

     

     

    Friday, December 8, 2006 4:54 PM