//sbHtml div 內容
//fileName 匯出來後文件名
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("-----------匯出資料異常-----------\r\n" + ex.ToString() + "\r\n");
//sbHtml div 內容
//fileName 匯出來後文件名
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("-----------匯出資料異常-----------\r\n" + ex.ToString() + "\r\n");
}