Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert image into cell using C# and Excel interop??
I'm trying to insert a bitmap from the harddrive into a cell of a
worksheet and can't seem to find anything in MSDN or on the net. I'm creating Excel (version 2003/11) from within a C# application ExcelApp = new Microsoft.Office.Interop.Excel.Application(); I recorded a macro and inserted a jpg into a cell and the code that Excel generated was the following Range("F20").Select ActiveSheet.Pictures.Insert("C:\Logo transparent.gif").Select In my C#/Winforms application I have code that looks like this currentSheet = (Excel.Worksheet)ExcelApp.Workbooks[0].Sheets[0]; Excel.Range range = currentSheet.get_Range("A1", "A1"); range.Select(); currentSheet.Pictures does not have any methods? I've looked at the range object and the WorkSheet object and haven't figured out how to insert a bitmap from a file I've seen code that uses the clipboard like this Image oImage = Image.FromFile(_stLOGO); System.Windows.Forms.Clipboard.SetDataObject(oImag e,true); ThisSheet.Paste(oRange,_stLOGO); do I have to use the clipboard I did the same in Word with one line of code WordApp.Selection.InlineShapes.AddPicture( Path.GetDirectoryName(System.Windows.Forms.Applica tion.ExecutablePath) + Path.DirectorySeparatorChar + "Logo.gif", ref oFalse, ref oTrue, ref oMissing); thanks mike |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
insert an image based on a cell value | New Users to Excel | |||
Export image from Excel using interop | Excel Programming | |||
How do I insert an image into a specific cell within a protected . | Excel Discussion (Misc queries) | |||
conditional insert image in a cell | Excel Programming | |||
How to insert a bitmap image into a Excel Cell? | Excel Programming |