网页中打印文本文件

protected void Page_Load(object sender, EventArgs e)
   {
       string path = Server.MapPath("App_Data\\ppp.txt");
       System.IO.StreamReader read = new System.IO.StreamReader(path, System.Text.Encoding.Default);
       this.Label1.Text = read.ReadLine();
       this.Label2.Text = read.ReadToEnd();
       read.Close();
   }
   protected void Button1_Click(object sender, EventArgs e)
   {
       Response.Write("<script>window.print()</script>");
   }

posted @ 2013-04-20 12:50  侯伟东  阅读(155)  评论(0编辑  收藏  举报