closedxml添加图像vb

时间:2015-11-11 16:22:16

标签: asp.net vb.net closedxml

我正在使用ASP.NET进行webform并且目前正在使用ClosedXML,有没有办法在工作表中插入一个位置?,我有这个代码

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()

2 个答案:

答案 0 :(得分:1)

更新:ClosedXML现在支持图片,请参阅here

原始回答:

  

如何插入图片?

     

你不能。虽然您可以打开已有图像的Excel   并保存图像,您无法插入新图像   ClosedXML。

from the official FAQ

答案 1 :(得分:0)

Raidri说,我认为你不能。

但是我使用它来使用Open XML,尽管它不是很简单:
http://polymathprogrammer.com/2009/11/30/how-to-insert-an-image-in-excel-open-xml/