StringWriter sw = new StringWriter();
sw.WriteLine("访问购买率");
sw.WriteLine("排行/t商品名称/t人气指数/t购买次数/t访问购买率");
int i = 0;
foreach (ProductSaleInfo productSale in productSaleList)
{
i = i + 1;
sw.WriteLine(i.ToString() + "/t" + productSale.Name.ToString() + "/t" + productSale.ViewCount.ToString() + "/t" + productSale.SaleCount.ToString() + "/t" + XWXCommon.ProductBuyRate(productSale.ViewCount.ToString(), productSale.SaleCount.ToString()));
}
sw.Close();
Response.Clear();
Response.Buffer = true;
Response.Charset = "GB2312";
Response.AppendHeader("Content-Disposition", "attachment;filename=visit_sold.xls");
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
Response.ContentType = "application/ms-excel";
Response.Write(sw);
Response.End();
ASP.NET数据库导入Excel
最新推荐文章于 2021-01-26 10:52:28 发布