You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.5 KiB
C#

2 months ago
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TradeData;
namespace TradeManage.TongJi
{
public partial class Report20 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
int ChaseId = Convert.ToInt32(CCID.Value);
var obj = new CG_ChaseData();
var md = obj.GetPurchaseModel(ChaseId);
var list = obj.GetPurchaseTableGoods(ChaseId);
if (md == null || list == null)
return ;
Response.AppendHeader("Content-Disposition", "attachment;filename=批次.xls");
//输出的应用类型
Response.ContentType = "application/vnd.ms-excel";
//设定编码方式若输出的excel有乱码可优先从编码方面解决
// Response.Charset = "gb2312";
Response.Charset = "gb2312";
Response.ContentEncoding = System.Text.Encoding.UTF8;
//关闭ViewState此属性在Page中
EnableViewState = false;
//filenames是自定义的文件名
//content是步骤1的html注意是string类型
Response.Write(Hidden1.Value);
Response.End();
}
}
}