日期:2014-05-17 浏览次数:20497 次
StringWriter sw = new StringWriter();
sw.WriteLine("券号\t券号状态\t使用时间\t使用供应商ID\t退款时间\t活动ID\t产品名称\t产品有效期");
foreach (DataRow dr in dt.Rows)
{
string s =dr["TicketNo"].ToString();
sw.WriteLine("'" + s + "'" + "\t"
+ OrderStatusToCN(dr["Status"]) + "\t"
+ updatetimestr+"\t"
+ dr["ProviderId"]+ "\t"
+ regundtimestr + "\t"
+ dr["productId"] + "\t"
+ CommonFunc.ConvertObjectToString(dr["productName"])+ "\t"
+ CommonFunc.ConvertDateTime(dr["ExpirationDate"])
);
}
sw.Close();
Response.AddHeader("Content-Disposition", "attachment; filename=" + System.DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls");
Response.ContentType = "application/vnd.ms-excel"; //"application/ms-excel";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
Response.Write(sw);
Response.End();