vb.net操作xls文件,并向其中加入图片

    Public Function InsertPicture() As String
        
 

         Dim oExcel As New Microsoft.Office.Interop.Excel.Application

        Dim obook As Microsoft.Office.Interop.Excel.Workbooks


        Dim oSheet As Microsoft.Office.Interop.Excel.Sheets

        Dim miss As System.Reflection.Missing


        miss = System.Reflection.Missing.Value

        oExcel.Visible = True

        oExcel.DisplayAlerts = False

        obook = oExcel.Workbooks.Open("c:\aa.xls", miss, miss, miss, miss, miss, miss, miss, miss, miss, miss, miss, miss, miss, miss)

        oSheet = obook.Item(1).ActiveSheet.Pictures.Insert("c:\aa.jpg").Select()

 

        Return ""

    End Function

你可能感兴趣的:(VB.NET)