ecotect 导出图片大小调整
发布网友
发布时间:2022-04-29 20:50
我来回答
共1个回答
热心网友
时间:2022-05-23 12:09
代码如下,但插入的图片是原始图片大小,我改图片的大小调整成单元格的大小.
oXLApp = New Application()
oXLBook = oXLApp.Workbooks.Add()
oXLSheet = oXLBook.Worksheets("Sheet1") 'Work with the first worksheet
Dim cn As New OdbcConnection(strCon)
cn.Open()
Dim strSql As String = "Select * from procts "
Dim cmd As New OdbcCommand(strSql, cn)
Dim dr As OdbcDataReader = cmd.ExecuteReader
With oXLSheet
.Columns("A:A").ColumnWidth = 22.25
While dr.Read
.Rows(intRow.ToString() + ":" + intRow.ToString()).RowHeight = 102
.Range("B" + (intRow).ToString() + ":B" + (intRow).ToString()).Value = dr("procts_model")
.Range("C" + (intRow).ToString() + ":C" + (intRow).ToString()).Value = dr("procts_image")
.Range("A" + (intRow).ToString() + ":A" + (intRow).ToString()).Select()
.Pictures.Insert( dr("procts_image")).Select()
intRow += 1
End While
End With
oXLApp.Visible = True 'Show it to the user