Welcome to WebmasterWorld Guest from 54.226.194.180

Forum Moderators: ocean10000

Message Too Old, No Replies

How to insert an image into spreadsheet from my resources

     

MBerner

7:29 am on May 14, 2012 (gmt 0)



I'm trying to create an add-in for excel with VSTO in VB.net, I imported an image(Logo1) in the resources folder of the project, now I would like to insert in the spreadsheet (mysheet).The image is into the installation package like example the images of the ribbons.
I tried

I tried

mysheett.Cells(10, 10) = My.Resources.ResourceManager.GetObject("Logo1")

also

mysheett.OLEObjects.Add(ClassType:="Forms.Image.1", Link:=False, _
DisplayAsIcon:=False, Left:=471.75, Top:=31.5, Width:=293.25, Height _
:=125.25).Select()
.Image1.Object.Picture = My.Resources.ResourceManager.GetObject("Logo1")

don't works

Ocean10000

1:52 pm on May 14, 2012 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



I found one link which walks though inserting an picture in a specific cell, and the related code. The only downside I see is the api assumes the file will be saved in the filesystem, and not sent as a stream object link you are attempting to do.

Inserting Pictures in Excel [exceltip.com]

MBerner

3:10 pm on May 14, 2012 (gmt 0)



Thanks, but the path must be my folder resources project.
Nobody knows how to do.

[edited by: Ocean10000 at 4:53 pm (utc) on May 14, 2012]
[edit reason] Removed Link [/edit]

Ocean10000

4:52 pm on May 14, 2012 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



The tricky way to do it is save the resource file to the local users temp folder, then do the insert from that file location, and delete it when you are done. So the master copy will always be in your install binary. But copies will be saved to the drive long enough to be read by the api call.

MBerner

5:10 pm on May 14, 2012 (gmt 0)



Complex solution, sorry for the link
I must understand how to use images from the resources folder
 

Featured Threads

Hot Threads This Week

Hot Threads This Month