日历归档 |
|
<< < 2024 - 11 > >> | Su | Mo | Tu | We | Th | Fr | Sa | | | | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
|
|
|
About Me |
|
|
ZhangSichu |
|
Male |
|
32 |
|
ZhangSichu@gmail.com |
|
ZhangSichu@hotmail.com |
|
ZhangSichu.com |
|
weibo.com/zhangsichu |
|
|
|
个人推荐 |
|
|
|
|
分类归档 |
|
|
|
|
My Friends |
|
|
|
|
Asp.Net 直接写一个Excel文件流
|
this.Page.Response.Clear(); this.Page.Response.BufferOutput = true; //Define Chareset this.Page.Response.Charset = "GB2312"; //For download. //Define type. this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename = ExcelFile.xls"); //Define encoding. this.Page.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); //Define Application type. this.Page.Response.ContentType = "application/ms-Excel";
string strExcelHeader = string.Empty; string strExcelItems = string.Empty;
//Write header; //Please pay a ation to the character "\t" strExcelHeader = "Column1\tColumn2\tColumn3\tColumn4\tColumn5\tColumn6\tColumn7\tColumn8\ttColumn9\t\n"; strExcelItems = "1 \t2 \t3 \t4 \t5 \t6 \t7 \t8 \t9 \t\n"; //Write Excel header. this.Page.Response.Write(strExcelHeader);
//Write a Excel item. this.Page.Response.Write(strExcelItems);
this.Page.Response.End();
|
|
|
|
|
|