[英]Convert from aspx page content to MS Word Format
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();
I am trying to convert from aspx page to word format. 我正在尝试从aspx页面转换为word格式。 When i launch the MS Word file generated it displays the dialog box Problems during load Missing file: c:\\Content\\Site.css
当我启动生成的MS Word文件时,它会显示对话框“加载过程中的问题”缺少文件:c:\\ Content \\ Site.css
Looks like it is unable to load the css file. 看起来无法加载css文件。 What is the solution.
解决办法是什么。 Please reply.
请回复。
try adding the following headers: 尝试添加以下标头:
Response.AddHeader("Content-Type: application/vnd.ms-word"); Response.AddHeader("Expires: 0");Response.AddHeader("Cache-Control: must-revalidate, post-check=0, pre-check=0");
Regards 问候
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.