aspnet導(dǎo)出word怎么把標(biāo)簽對也導(dǎo)出了?
//記得不能用ajax 請求 | submit 和服務(wù)器按鈕都可以
//sbHtml div 內(nèi)容
//fileName 導(dǎo)出來后文件名
public static void Export(StringBuilder sbHtml, string fileName)
{
try
{
if (sbHtml.Length > 0)
{
HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
HttpContext.Current.Response.Charset = "Utf-8";
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileName + ".docx", System.Text.Encoding.UTF8));
HttpContext.Current.Response.Write(sbHtml.ToString());
HttpContext.Current.Response.End();
}
}
catch (Exception ex)
{
Logger.WriteLog("-----------導(dǎo)出數(shù)據(jù)異常-----------\r\n" + ex.ToString() + "\r\n");
}