导出gridview以使用图像优秀 [英] export gridview to excel with images

查看:65
本文介绍了导出gridview以使用图像优秀的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网络表单中有一个gridview,其中包含调整大小为40X40像素的图像,但是当我将gridview导出为ex​​cel时,图像返回到原始大小,我可以将gridview导出为ex​​cel,图像大小调整为我想要的大小



这是我使用的导出代码



I have a gridview in web form that contains images resized to 40X40 px but when I export the gridview to excel the images return to there original size how I can export the gridview to excel with images resized to my desired size

this is the export code I use

Try
    GridView2.AllowPaging = False

    Response.Clear()
    Response.AddHeader("content-disposition", "attachment;filename=ComputerParts.xls")
    Response.ContentType = "application/ms-excel"
    Response.ContentEncoding = System.Text.Encoding.Unicode
    Response.BinaryWrite(System.Text.Encoding.Unicode.GetPreamble())

    Dim sw As System.IO.StringWriter = New System.IO.StringWriter()
    Dim hw As System.Web.UI.HtmlTextWriter = New HtmlTextWriter(sw)

    txtSelectedComputer.RenderControl(hw)
    txtEmployeeName.RenderControl(hw)
    GridView2.RenderControl(hw)

    Response.Write(sw.ToString())
    Response.End()

    GridView2.AllowPaging = True

Catch ex As SqlException
    Masterlbl1.Text = GeneralFuctions.interpret_error_number(ex.Number)
Catch ex As Exception
    Masterlbl2.Text = "حدث خطأ غير متوقع. مصدر الخطأ:" & ex.Source.ToString
End Try

推荐答案

我遇到同样的问题..请帮忙
I have the same problem..please help


这篇关于导出gridview以使用图像优秀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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