这篇文章主要介绍了vb.net将图片导入到excel的方法,只要借助剪贴板将图片粘贴到excel中就可以完成了,大家参考使用吧
复制代码 代码如下: Dim im as Image=Image.FromFile ("C:/picture.bmp") '获得Image
System.Windows.Forms.Clipboard.SetDataObject(im, True) '复制到剪贴板
Dim xlApp As Excel.Application = New Excel.Application() Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
xlBook = xlApp.Workbooks().Add xlSheet = xlBook.Worksheets("sheet1")
Dim range As Excel.Range = xlSheet.Range(xlApp.Cells(4, 1), xlApp.Cells(4, 1)) '粘贴图片的位置 xlSheet.Paste(range, im) '将图片插入Excel
|