里面有表格。页眉,页脚,页码什么的。
1,html再转word,好像有点麻烦。
2,用水晶报表,但是转移到另一台机子上就连不上access了,提示要密码,我的access根本没密码,设置了相对路径也不行。
3,直接输出word,那字体格式什么的怎么控制?

解决方案 »

  1.   


    HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(filename + ".doc", System.Text.Encoding.UTF8)); 
    HttpContext.Current.Response.ContentType = "application/ms-word"; 
          
    HttpContext.Current.Response.Charset = "UTF-8"; 
    HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8; //关闭控件的视图状态 
    source.Page.EnableViewState = false; //初始化HtmlWriter 
    System.IO.StringWriter writer = new System.IO.StringWriter(); 
    System.Web.UI.HtmlTextWriter htmlWriter = new System.Web.UI.HtmlTextWriter(writer); 
    source.RenderControl(htmlWriter); //输出 
    HttpContext.Current.Response.Write(writer.ToString()); 
    HttpContext.Current.Response.End();