如何从包含图像的网格中将数据导出到Excel? [英] How can i export data in to excel from a grid which contains image?

查看:87
本文介绍了如何从包含图像的网格中将数据导出到Excel?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从grid中将数据导出到excel。我的网格包含图像。

使用以下代码,

I want to export data in to excel from grid. My grid contains image.
Am using the following code,

private void CreateXL()
   {

       Response.Clear();
       Response.AddHeader("content-disposition", "attachment;filename=xxxxxxxt.xls");
       Response.Charset = "";



       Response.ContentType = "application/vnd.xls";
       StringWriter objStringWriter = new StringWriter();
       HtmlTextWriter objHtmlTextWriter = new HtmlTextWriter(objStringWriter);

       Gridview.RenderControl(objHtmlTextWriter);
       Response.Write(objStringWriter.ToString());
       Response.End();
   }





但是在Excel中我无法看到图像,而不是图像我得到的消息,

''链接的图像无法显示>该文件可能已被移动,重命名或删除。验证链接指向正确的文件和位置。



如何解决此问题?



But in excel am not able to see the images, instead of image am getting message that,
''The linked image cannot be displayed> The file may have been moved,renamed or deleted.Verify the links points to the correct file and location.

How can i solve this problem?

推荐答案

您好Kavitha,



我认为以下链接可以解决您的问题。看一看。



http://www.aspsnippets.com/Articles/Export-GridView-with-Images-to-Word-Excel-and-PDF-Formats- in-ASP.Net.aspx [ ^ ]



问候,

Manoj
Hi Kavitha,

I think the below link will solve your problem. Take a look into that.

http://www.aspsnippets.com/Articles/Export-GridView-with-Images-to-Word-Excel-and-PDF-Formats-in-ASP.Net.aspx[^]

Regards,
Manoj


这篇关于如何从包含图像的网格中将数据导出到Excel?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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