none
Adding a picture programatically RRS feed

  • Question

  • Hi 

    I am working on an application level addin for Excel 2010 using C#. 

    My question is how to add a picture to a worksheet when users click a button on a worksheet. 

    Is it possible to deploy the addin with a picture therefore it is not stored in users computer? 

    I added an sample picture in the solution explorer but not sure how to add the picture from there. 

    Could you help me please? 

    Thank you

    Kind regard 

    Mark

    Wednesday, January 2, 2013 7:18 AM

Answers

  • Hi Mark

    I did something similar with a PowerPoint add-in, recently...

    Select the graphics file(s) in the Solution Explorer, then go to the Properties pane.

    Set the "BuildAction" to "Content" and "Copy to Output directory" to "Always". That should make sure that the pictures are compiled as part of your project.

    The path will be something like this:
       AppDomain.CurrentDomain.BaseDirectory +"\\" + ObstacleName.jpg

    where BaseDirectory is where the add-in dll resides.


    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, January 2, 2013 1:30 PM
    Moderator

All replies

  • Hi Mark

    I did something similar with a PowerPoint add-in, recently...

    Select the graphics file(s) in the Solution Explorer, then go to the Properties pane.

    Set the "BuildAction" to "Content" and "Copy to Output directory" to "Always". That should make sure that the pictures are compiled as part of your project.

    The path will be something like this:
       AppDomain.CurrentDomain.BaseDirectory +"\\" + ObstacleName.jpg

    where BaseDirectory is where the add-in dll resides.


    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, January 2, 2013 1:30 PM
    Moderator
  • Thank you!

    I will try it!!!

    Wednesday, January 2, 2013 11:06 PM
  • Hi 

    I have just tried it and it works!!!!! 

    Thanks miliion!!!

    Wednesday, January 2, 2013 11:08 PM