2
我想從包含圖像的網格中將數據導出到excel。如何從包含圖像的網格將數據導出到excel中?
我使用下面的代碼 -
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中是無法看到圖像,而不是圖像的我得到一個消息,說,「無法顯示該文件的鏈接的圖像可以有已被移動,重命名或刪除。確認鏈接指向正確的文件和位置。'
我該如何解決這個問題?
這個網址肯定會幫助你很多.... http://www.aspsnippets.com/Articles/Export-GridView-with-Images-to-Word- Excel和PDF格式在ASP.Net.aspx – 2013-03-13 13:01:28
是適合你的工作???????? – 2013-03-13 15:27:16