我有一個網頁形式的網格視圖,其中包含圖像調整大小爲40X40像素,但是當我導出的網格視圖出色的圖像返回到那裏原始大小如何我可以出口的網格視圖到Excel與圖像調整爲我的期望尺寸asp.net:export gridview與圖像excell
這是出口代碼我使用
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
抓住前作爲SQLEXCEPTION Masterlbl1.Text = GeneralFuctions.interpret_error_number(ex.Number) 抓住前作爲異常 Masterlbl2。 Text =「حدثخطأغيرمتوقع。مصدرال طأ:」 & ex.Source.ToString 結束Try
有趣的是,你是對的。但是我們如何修改導出代碼以更好地完成任務 –
您可以在Image控件的Attributes屬性中添加一個條目。恩。 myImage.Attributes.Add(「width」,「10」)。最好你可以讓這個語句只在導出到Excel時執行。 – hexaium
該屬性在我的webform中以正確的語法正確設置,但導出代碼以新方式自動生成,並且excel只理解舊方式 –