vb.net借助剪贴板将图片导入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

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjzpzp.html