2015-11-11 58 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

感謝,這是很好的瞭解,有幾個方式,但非常複雜,最終我用一個文件與圖像空白 –