Welcome to WebmasterWorld Guest from 23.22.182.29

Forum Moderators: ocean10000

Message Too Old, No Replies

How to insert an image into spreadsheet from my resources

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

New User

joined:May 14, 2012
posts:3
votes: 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
1:52 pm on May 14, 2012 (gmt 0)

Administrator

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month

joined:Jan 14, 2004
posts:852
votes: 0


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]
3:10 pm on May 14, 2012 (gmt 0)

New User

joined:May 14, 2012
posts:3
votes: 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]

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

Administrator

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month

joined:Jan 14, 2004
posts:852
votes: 0


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.
5:10 pm on May 14, 2012 (gmt 0)

New User

joined:May 14, 2012
posts:3
votes: 0


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