Response.ContentType = "application/word";
Response.AddHeader("content-disposition", "inline;filename=TestPage.doc");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
this.Page.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
Response.Write(sw);
Response.End();
Response.Flush();
我正在尝试从aspx页面转换为word格式。当我启动生成的MS Word文件时,它会显示该对话框 装载时出现问题 缺少文件:c:\ Content \ Site.css
看起来无法加载css文件。解决办法是什么。请回复。
答案 0 :(得分:0)
尝试添加以下标题:
Response.AddHeader("Content-Type: application/vnd.ms-word"); Response.AddHeader("Expires: 0");Response.AddHeader("Cache-Control: must-revalidate, post-check=0, pre-check=0");
此致