|get| 2006-09-19
产生一个免保存在服务器端的流,直接下载
1
StringWriter sw=new StringWriter();
2
sw.WriteLine("科目名称\t凭证日期\t借方\t贷方");
3
string s="";
4
foreach(DataRow dr in Items.Rows)
5
{
6
s = dr["AccountName"].ToString();
7
s += "\t" + Convert.ToDateTime(dr["VouDate"]).ToString("yyyy-MM-dd");
8
s += "\t" + dr["Debit"].ToString() + "\t" + dr["Credit"].ToString();
9
sw.WriteLine(s);
10
}
11
sw.Close();
12
Response.Clear();
13
Response.AddHeader("Content-Disposition", "attachment; filename=filename.xls");
14
Response.ContentType = "application/ms-excel Response.ContentEncoding=System.Text.Encoding.Default;
15
Response.Write(sw);// 把流发送到客户端
16
Response.End();
StringWriter sw=new StringWriter();2
sw.WriteLine("科目名称\t凭证日期\t借方\t贷方");3
string s="";4
foreach(DataRow dr in Items.Rows)5
{6
s = dr["AccountName"].ToString();7
s += "\t" + Convert.ToDateTime(dr["VouDate"]).ToString("yyyy-MM-dd");8
s += "\t" + dr["Debit"].ToString() + "\t" + dr["Credit"].ToString();9
sw.WriteLine(s);10
}11
sw.Close();12
Response.Clear();13
Response.AddHeader("Content-Disposition", "attachment; filename=filename.xls");14
Response.ContentType = "application/ms-excel Response.ContentEncoding=System.Text.Encoding.Default;15
Response.Write(sw);// 把流发送到客户端 16
Response.End();


浙公网安备 33010602011771号