将html转换为mvc中的doc文件 [英] convert html to doc file in mvc
本文介绍了将html转换为mvc中的doc文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
public ActionResult Index()
{
ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
var htmlHelper = new HtmlHelper(new ViewContext(
ControllerContext,
new WebFormView(ControllerContext, "HACK"),
new ViewDataDictionary(),
new TempDataDictionary(),
new StringWriter()),
new ViewPage());
var otherViewHtml = htmlHelper.Action("About", "Home");
HttpContext.Response.Clear();
HttpContext.Response.Charset = "";
HttpContext.Response.ContentType = "application/msword";
string strFileName = "test" + ".doc";
HttpContext.Response.AddHeader("Content-Disposition", "inline;filename=" + strFileName);
StringBuilder strHTMLContent = new StringBuilder();
strHTMLContent.Append(otherViewHtml);
HttpContext.Response.Write(strHTMLContent);
HttpContext.Response.End();
HttpContext.Response.Flush();
return View();
}
推荐答案
请查看我过去的答案:
如何从MS Visual Studio 2010中的添加引用添加microsoft excel 15.0对象库 [ ^ ],
在不使用Interop.word dll的情况下读取word文件...不想在IIS中安装单词。 [ ^ ],
您好我怎样才能在win中显示word文件使用c#.net 显示应用程序[ ^ ]。
-SA
Please see my past answers:
How to add microsoft excel 15.0 object library from Add Reference in MS Visual Studio 2010[^],
Read a word file without using Interop.word dll...Do not want to install word in IIS..[^],
Hi how can i display word file in windows application using c#.net[^].
—SA
这篇关于将html转换为mvc中的doc文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文