image to excel cell

ideprize

Well-known member
Joined
Oct 19, 2011
Messages
97
Programming Experience
10+
Hi All
I am trying (very unsuccessfully) to load an image into an image variable from a disk file. I have used the image.fromfile (disk file) method without complaints but the only "thing" that resides in the image variable after the code execution is the "System.Drawing.Bitmap" statement. What I am trying to do is assign the image which is a "signature" (view-able with Paint) captured via a Topaz signature device (have that working) to an Excel spreadsheet cell. In short how do I get the IMAGE!!
Any insight would be greatly appreciated.
Respectfully,
IDEPRIZE
 
You are mistaken. There is no "System.Drawing.Bitmap" statement. That is simply the way the VS IDE tells you what the variable contains. It is telling you that the variable refers to a System.Drawing.Bitmap object, which is exactly what you'd expect. To answer your question, you already have the image. That's what a Bitmap object is.

I think that what you're actually saying, without actually saying, is that you want to know how to display that Image to the user. In that case, you can assign the Image object to the Image property of a PictureBox control. Just as a Label displays the contents of a String, so a PictureBox displays the contents of an Image.

Better than calling Image.FromFile and assigning the result to the Image property though, is usually calling the Load method of the PictureBox and passing the file path. That way the PictureBox will open the file and load the Image itself, without keeping the file locked.
 
Thank you Jim for the quick response. You are correct - I did not understand that "level of indirection". I will play with the picturebox transform but my ultimate desire is to place this image in an Excel spreadsheet cell? Is this possible? What currently appears on the spreadsheet in that cell is the "System.Drawing.Bitmap" verbiage.
Respectfully,
IDEPRIZE
 
For future reference, please provide ALL relevant information when you post a question. Given that you have posted in a Windows Forms forum, the fact that you actually want to display an image in an Excel worksheet is obviously something that we will simply divine for ourselves. I imagine that it's possible but it's not something that I've ever done. Have you done the obvious and Googled vb.net image excel or the like?
 
Hi Jim
Sorry if I placed this in the wrong forum. I did state in the original post that I ultimately wanted to place the image in an Excel spreadsheet cell. This is very possible to do with the tools available in Excel, i.e. insert and then browse to the file - and this does indeed work with the signature file that I am trying to insert programmatically. This insertion method, of course, requires user intervention which is precisely what the application is eliminating. Again thanks for your help.
Respectfully,
IDEPRIZE
 
I did state in the original post that I ultimately wanted to place the image in an Excel spreadsheet cell.

So you did. I must have overlooked that in my haste. My apologies.
 
To Jim no problem.
To John, I used the Microsoft.Office.Core.MsoTriState.msoFalse system which lets you place a picture on the spreadsheet via the "worksheet.shapes.addpicture" structure. With this methodology you don't use the cell reference you treat the sheet as an xy coordinate plane. I will look into the methodology you referenced, however. Thanks guys it is always fruitful coming to this forum.
Respectfully,
IDEPRIZE
 
Back
Top