问题描述
我试图使用下面的代码将mt aspx页面导出为word格式,
pageObject.Response.Clear();
pageObject.Response.AddHeader(content-disposition,attachment; filename = FileName.doc);
pageObject.Response.Charset =;
pageObject.Response.Cache.SetCacheability(HttpCacheability.NoCache);
pageObject.Response.ContentType =application / doc;
StringWriter stringWrite = new StringWriter();
HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
myDiv.RenderControl(htmlWrite);
pageObject.Response.Write(stringWrite.ToString());
pageObject.Response.End();
代码生成了输出,但无论CSS应用于页面还是应用于word文档(输出d) oc)。
请帮助我。
谢谢。
Hi,
I was trying to export mt aspx page to word format using the below code,
pageObject.Response.Clear();
pageObject.Response.AddHeader("content-disposition", "attachment; filename=FileName.doc");
pageObject.Response.Charset = "";
pageObject.Response.Cache.SetCacheability(HttpCacheability.NoCache);
pageObject.Response.ContentType = "application/doc";
StringWriter stringWrite = new StringWriter();
HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
myDiv.RenderControl(htmlWrite);
pageObject.Response.Write(stringWrite.ToString());
pageObject.Response.End();
Code was produced the output but whatever CSS has been applied to the page which are not applied to the word document(output doc).
Kindly help me.
Thanks .
这篇关于在ASP.net中将aspx页面导出为单词c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!