1.新建一个word文档,然后把你想要显示的布局在word文档上布局好,然后另存为xx.html;

2.以word打开方式打开xx.html,点击视图,选择页面视图,然后保存!

3.打开xx.html,同样用打开word的方式打开,然后选择页面视图,然后在里面随便修改一点,我自己是弄个空格然后点保存

4.后台代码:

Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader("content-disposition","attachment;filename="+name+".doc");
Response.AddHeader("Content-type","application");
Response.ContentType = "application/ms-html";
Response.ContentEncoding = System.Text.Encoding.Default;
Response.Write(sb.ToString());
Response.Flush();
Response.Close();

posted on 2012-07-14 17:39  轻盈  阅读(462)  评论(0编辑  收藏  举报