本文介绍了在ASP.net中将aspx页面导出为单词c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我试图使用下面的代码将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#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 18:18