直接寫成html的格式
然後匯出成excel的格式
------------------------------------------------------------------------------
範例:
using System.IO;
Response.Clear();
Response.Charset = "big5";
Response.AddHeader("Content-Disposition",
"attachment;filename="+Server.UrlEncode(FileNameC)
);
Response.ContentType = "application/vnd.ms-excel";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("big5");
Response.Write("<@html><@body>"); //拿掉@
Response.Write("<@meta http-equiv=Content-Type content=text/html; charset=big5>");//拿掉@
Response.Write("<@style type=text/css>");//拿掉@
Response.Write("td{mso-number-format:\"\\@\";}");
Response.Write(".formCaption1={back-color=#CECFCE;font-size=12px;height=24px;}");
Response.Write("@style>");//拿掉@
System.IO.StringWriter sw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter tw = new System.Web.UI.HtmlTextWriter(sw);
sw.WriteLine("
合格證資料轉出(批次-汽車) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
列印日期:"+DateTime.Now.ToString("yyyy/MM/dd")+" |
//title
sw.WriteLine(@"
... |
... |
Response.Write("
"); Response.Write(sw.ToString()); Response.Write(" |
Response.Write("@body>@html>");//拿掉@
Response.End();
沒有留言:
張貼留言