在Asp.net中打印图像 [英] Print Image in Asp.net
本文介绍了在Asp.net中打印图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想打印放置在div中的页面的一部分.另外,此div具有背景图片.
任何人都可以帮助我在asp.net中打印带有内容的图像??
在此先感谢....
Hi,
I want to print a part of the page which i have placed in a div. Also, This div having a background image.
anybody can help me to print image with content in asp.net???
thanks in advance....
推荐答案
尝试使用asp:table
并导出到excel或doc
那么您就可以打印出精美的样式.
幸运的你.
请:导出到excel函数,如下所示:
受保护的void OutExcel(表dg,字符串名称)
{
//dg.Visible = true;
Response.Clear();
Response.Buffer = true;
Response.Charset ="utf-8";
name ="attachment; filename =" + name;
Response.AppendHeader("Content-Disposition",name);
Response.ContentEncoding = System.Text.Encoding.GetEncoding(65001);
Response.Write(<元http-equiv = Content-Type content = text/html; charset = UTF-8>");
//Response.ContentType ="application/ms-excel";
Response.ContentType ="application/vnd.word";
dg.EnableViewState = false;
System.IO.StringWriter oStringWriter =新的System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter =新的System.Web.UI.HtmlTextWriter(oStringWriter);
dg.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
}
Hi,
try to use asp:table
and export to excel or doc
then you can print with good style.
lucky you.
pls: Export to excel function as following:
protected void OutExcel(Table dg, string name)
{
// dg.Visible = true;
Response.Clear();
Response.Buffer = true;
Response.Charset = "utf-8";
name = "attachment;filename=" + name;
Response.AppendHeader("Content-Disposition", name);
Response.ContentEncoding = System.Text.Encoding.GetEncoding(65001);
Response.Write("<meta http-equiv=Content-Type content=text/html;charset=UTF-8>");
//Response.ContentType = "application/ms-excel";
Response.ContentType = "application/vnd.word";
dg.EnableViewState = false;
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
dg.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
}
这篇关于在Asp.net中打印图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文