日期:2014-05-17 浏览次数:20599 次
protected void outword_Click()
{
//Word
string strFileName = "入库单-" + ins_idtb.Text;
//string httpHeader = "attachment;filename= " + HttpUtility.UrlEncode(strFileName + ".doc");
//Response.AppendHeader("Content-Disposition ", httpHeader);
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(strFileName + ".doc") + "");
Response.ContentType = "application/ms-word";
Response.Charset = "UTF-8";
Response.ContentEncoding = System.Text.Encoding.UTF8;
//关闭控件的视图状态
out_word.EnableViewState = false;
//初始化HtmlWriter
System.IO.StringWriter writer = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWriter = new System.Web.UI.HtmlTextWriter(writer);
out_word.RenderControl(htmlWriter);
//输出
Response.Write(writer.ToString());
Response.End(); }