首先在设计Excel报表模板的时候,如下图所示将Lot列的内容设置为: [&&BarCode.gif,2,2,60,20]
替换有多个图片的,可以使用
[&&图片1.jpg,2,2,60,20]
[&&图片2.jpg,2,2,60,20]
最后将BuildDetail事件代码设置为:
If e.Book.TempLate = "模板名称" Then
If e.region = "细节区名称" Then
Dim ftp1 As new ftpclient
ftp1.host="196.128.143.28"
ftp1.Account = "foxuser"
ftp1.password = "138238110"
If ftp1.Download(e.DataRow("图片1"),"c:\data\Desert.jpg") = True Then
Dim file As String = "c:\data\Desert.jpg"
Dim img As image = getImage(file)
Dim bmp As new bitmap(img, 100, 100 * (img.height / img.width))
bmp.save(ProjectPath & "Images\图片1.jpg")
bmp.Dispose
End If
If ftp1.Download(e.DataRow("图片2"),"c:\data\Desert2.jpg") = True Then
Dim file As String = "c:\data\Desert2.jpg"
Dim img As image = getImage(file)
Dim bmp As new bitmap(img, 100, 100 * (img.height / img.width))
bmp.save(ProjectPath & "Images\图片2.jpg")
bmp.Dispose
End If
End If
End If