closedxml添加图片VB [英] closedxml add image vb

查看:1121
本文介绍了closedxml添加图片VB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做ASP.NET中的一个WebForm,目前与ClosedXML工作,是否有插入工作表内部的图像中的位置的方式?我有这个code

 昏暗WB作为新XLWorkbook()
昏暗的WS作为IXLWorksheet = wb.Worksheets.Add(NAME)
昏暗HTT presponse =响应
HTT presponse.Clear()
HTT presponse.ContentType =应用程序/ vnd.openxmlformats-officedocument.s preadsheetml.sheet插入图片HERE
ws.insertimage(的ImagePath)'?昏暗namedoc的String =namedoc
HTT presponse.AddHeader(内容处置,附件;文件名=+ namedoc +的.xl​​sx)
使用tmpMemoryStream作为MemoryStream的=新的MemoryStream()
    wb.SaveAs(tmpMemoryStream)
    tmpMemoryStream.WriteTo(HTT presponse.OutputStream)
    tmpMemoryStream.Close()
使用完
HTT presponse.End()


解决方案

  

如何插入图片?


  
  

您不能。虽然你可以打开一个已经有一个形象的Excel
  并保存preserving形象,不能插入一个新的形象
  ClosedXML。


<一个href=\"https://closedxml.$c$cplex.com/wikipage?title=How%20can%20I%20insert%20an%20image%3F&referringTitle=Documentation\"相对=nofollow>从官方FAQ

i am doing a webform in ASP.NET and currently working with ClosedXML,is there a way to insert an image inside a worksheet in a position?, i have this code

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

解决方案

How can I insert an image?

You can't. Although you can open an Excel that already has an image and save it preserving the image, you can't insert a new image with ClosedXML.

from the official FAQ

这篇关于closedxml添加图片VB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆