K S Reddi Prasad

K S Reddi Prasad

  • NA
  • 28
  • 74.9k

How to give the path of Solution Explorer's ' images' folder.

Apr 28 2011 2:06 AM

Hi all,

I have created a vsto addin for word 2007.In this addin, I am generating the ribbon using a custom xml file present in the server. This Custom xml file i am getting from the wcf service.

Now, In my local vsto solution explorer, i have an 'images' folder, through which i am giving images to my ribbon buttons.(I am  dynamically loading the ribbon using the custom xml file in the server and images folder in my solution explorer.)

  I am using the following path to get the "images" folder in my solution explorer.

                      string path = AppDomain.CurrentDomain.BaseDirectory;

                       string[] pathArray = path.Split(new char[] {'\\'});
                       path = string.Empty;
                        for (int temp = 0; temp < pathArray.Count() - 3; temp++)
                        {
                            if (temp == 0)
                                path = path + pathArray[temp];
                            else
                                path = path+ "\\" + pathArray[temp];
                        }


             Now, when i am installing the .vsto file in other system, it is searching the 'images' folder in documents and settings and showing the error mesage" c:\\Documents& Settings\\images\\refresh.gif".

Even i tried with the following paths,it is searching the 'images' folder in following paths:

string path = Application.startupPath------> looking for 'images' folder in Program files.

string path = Application.ExecutablePath---------> looking for 'images' folder in Office Folder in Program files.

string path = Environment.CurrentDirectory--------> looking for 'images' folder in c:\\Documents & settings.

How can i  give dynamic images with my .vsto file or is there any other path for giving my solution explorer's image folder.

Any help will be greatly appreciated.

Thanks,

KSR Prasad.

Answers (1)