您好,我有一个问题,就像我正在使用剑道 UI 编辑器 https://demos.telerik.com/aspnet-mvc/editor/import-export并将详细信息保存到数据库中,此 UI 编辑器的内容(如屏幕截图文本输入数据等)同时在 UI 中检索和显示我能够通过解码来显示。但我有需要导出到 word 的要求。当我想将内容从 DB 导出到 Word 时,我会再次对其进行解码并导出,但屏幕截图没有导出到 word。请帮助寻找解决方案
这是代码:
public void ExporttoHtml(int no)
{
HttpContext.Response.Clear();
HttpContext.Response.Charset = "";
#region HtmlDesign
System.Web.HttpContext.Current.Response.ContentEncoding = Encoding.UTF8;
Response.ContentEncoding = Encoding.Default;
HttpContext.Response.ContentType = "application/msword";
Response.AddHeader("content-disposition", "attachment; filename=" + no + ".doc");
StringBuilder bodycontent = new StringBuilder("");
GetContentToExporttoWord(bodycontent, no);
#endregion
#region Rendering
HttpContext.Response.Write(bodycontent);
HttpContext.Response.End();
HttpContext.Response.Flush();
#endregion
}
private void GetContentToExporttoWord(StringBuilder bodycontent, int no)
{
Exportdetail objecdet = GetDetailsfromDB(no);
bodycontent.Append(@"<html
xmlns:o='urn:schemas-microsoft-com:office:office'
xmlns:w='urn:schemas-microsoft-com:office:word'
xmlns='http://www.w3.org/TR/REC-html40'>
<head><title></title>
</head>
<body lang=EN-US style='tab-interval:.5in'>");
bodycontent.Append("<h2><table valign = 'middle' width = '100%' Border = '0' Cellpadding = '2' Cellspacing = '2'><tr>");
bodycontent.Append("<div class='Section1'>");
bodycontent.Append("<table valign = 'middle' width = '100% ' Border = '0' Cellpadding = '2' Cellspacing = '2' class='page-break-after:always'>");
bodycontent.Append("<td colspan='2'><b><span style=' width:100px;'>Request Description: </span></b> " + HttpUtility.HtmlDecode(objecdet.EditorData + "</td></tr></div>"));
}
public class Exportdetail
{
public string EditorData { get; set; }
}
}