我在導出GridView中的數據時用的是如下方法,但如果有圖片時,卻打印不出來,求高手解決一下,
怎么才能解決這個問題。我想了一下可能要把輸出流轉換成二進制流才可以。
?protected void Button_print_Click(object sender, EventArgs e)??? {??????? System.Web.HttpContext HC = System.Web.HttpContext.Current;??????? HC.Response.Clear();??????? HC.Response.Charset = "GB2312";??????? HC.Response.Buffer = true;??????? HC.Response.ContentEncoding = System.Text.Encoding.UTF7;??????? HC.Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("查詢結果打印", System.Text.Encoding.UTF8) + ".doc");??????? HC.Response.ContentType = "application/ms-word";//如果要打印為excel格式,則換為"application/excel"??????? this.EnableViewState = false;??????? System.IO.StringWriter sw = new System.IO.StringWriter();??????? System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);??????? this.GV_result.RenderControl(htw);??????? HC.Response.Write(sw.ToString());??????? HC.Response.End();??? }//打印輸出按鈕
- 1 回答
- 0 關注
- 325 瀏覽
添加回答
舉報
0/150
提交
取消