[英]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();
我正在嘗試從aspx頁面轉換為word格式。 當我啟動生成的MS Word文件時,它會顯示對話框“加載過程中的問題”缺少文件:c:\\ Content \\ Site.css
看起來無法加載css文件。 解決辦法是什么。 請回復。
嘗試添加以下標頭:
Response.AddHeader("Content-Type: application/vnd.ms-word"); Response.AddHeader("Expires: 0");Response.AddHeader("Cache-Control: must-revalidate, post-check=0, pre-check=0");
問候
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.