【发布时间】:2015-01-02 08:11:48
【问题描述】:
我正在努力解决需要将位图图像分配给表格单元格的问题。实际上,我将签名作为图像保存在数据库中,并从数据库中获取图像数据,然后将其转换为位图图像并成功在 winform 中显示。我现在需要在生成 html 电子邮件时在 html 单元格中显示图像。
抓取数据到位图的代码如下:
If Not (strucJob.ClientSignature Is Nothing) Then
Dim imageData As Byte() = strucJob.ClientSignature
If Not imageData Is Nothing Then
Dim ms As MemoryStream = New MemoryStream()
ms.Write(imageData, 0, Convert.ToInt32(imageData.Length))
signature = New Bitmap(ms, False)
ms.Dispose()
End If
End If
在这里我需要将图像指定为单元格背景:
bodyText = bodyText & "<tr>" & _
"<td colspan=3 align=left bgcolor = 'white' valign=top><FONT size=2>" & _
"background: " & String.Format("background:url('{0}')", signature) & _
"</td>" & _
"<td align=left bgcolor = 'white' valign=top><FONT size=2>" & _
"<b>" & singNamw & "</b>" & _
"</td>" & _
"</tr>"
这就是给我带来麻烦的地方:
"<td colspan=3 align=left bgcolor = 'white' valign=top><FONT size=2>" & _
"background: " & String.Format("background:url('{0}')", signature) & _
"</td>" & _
【问题讨论】:
标签: vb.net image winforms bitmap html-email