2015-11-11 34 views
2

我做在ASP.NET中的表单,目前与ClosedXML工作,是否有插入工作表内部的图像中的位置的方式?我有这样的代码closedxml添加图像VB

Dim wb As New XLWorkbook() 
Dim ws As IXLWorksheet = wb.Worksheets.Add("NAME") 
Dim httpResponse = Response 
httpResponse.Clear() 
httpResponse.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" 

'INSERT IMAGE HERE' 
ws.insertimage("imagepath")'??? 

Dim namedoc As String = "namedoc" 
httpResponse.AddHeader("content-disposition", "attachment;filename=""" + namedoc+ ".xlsx""") 
Using tmpMemoryStream As MemoryStream = New MemoryStream() 
    wb.SaveAs(tmpMemoryStream) 
    tmpMemoryStream.WriteTo(httpResponse.OutputStream) 
    tmpMemoryStream.Close() 
End Using 
httpResponse.End() 

回答

1

如何插入图像?

你不能。尽管您可以打开一个已经有图像的Excel,并保存它以保留图像,但您无法通过 ClosedXML插入新图像。

from the official FAQ

+0

感谢,这是很好的了解,有几个方式,但非常复杂,最终我用一个文件与图像空白 –