导出Excel--处理标题
来源:互联网 发布:isp 网络拓扑 编辑:程序博客网 时间:2024/05/22 14:34
if (this.rptList.Items.Count < 1)
{
EventMessage.MessageView(1, Icon_Type.Error, "对不起,你要导出的列表里没有数据,请重新操作!", "javascript:history.back();");
}
//定义文档类型、字符编码
string title = "学生欠费信息表" + "_" + DateTime.Today.ToShortDateString();
Response.Clear();
Response.Buffer = true;
Response.Charset = "gb2312";
string filename = "attachment;filename=" + System.Web.HttpUtility.UrlEncode(title, System.Text.Encoding.UTF8) + ".xls";
Response.AppendHeader("Content-Disposition", filename);
Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
//Response.ContentType指定文件类型 可以为application/ms-excel、application/ms-word、application/ms-txt、application/ms-html 或其他浏览器可直接支持文档
Response.ContentType = "application/vnd.ms-excel";
Response.Write("<meta http-equiv=Content-Type content=\"text/html; charset=gb2312\">");
this.EnableViewState = true;
// 定义一个输入流
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
oStringWriter.Write("<table><tr align='center' style='border:1px #000 solid;'><td width='80'>记录编号</td><td width='80'>用户姓名</td><td width='80'>缴费学生姓名</td><td width='80'>缴费年度</td><td width='80'>年度应缴金额</td><td width='80'>实缴金额</td><td width='80'>欠费金额</td><td width='150'>记录时间</td></tr>");
this.rptList.RenderControl(oHtmlTextWriter);
oStringWriter.Write("</table>");
//this.rptList.RenderControl(oHtmlTextWriter);
//this 表示输出本页,或其他支持obj.RenderControl()属性的控件
Response.Write(oStringWriter.ToString());
Response.End();
{
EventMessage.MessageView(1, Icon_Type.Error, "对不起,你要导出的列表里没有数据,请重新操作!", "javascript:history.back();");
}
//定义文档类型、字符编码
string title = "学生欠费信息表" + "_" + DateTime.Today.ToShortDateString();
Response.Clear();
Response.Buffer = true;
Response.Charset = "gb2312";
string filename = "attachment;filename=" + System.Web.HttpUtility.UrlEncode(title, System.Text.Encoding.UTF8) + ".xls";
Response.AppendHeader("Content-Disposition", filename);
Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
//Response.ContentType指定文件类型 可以为application/ms-excel、application/ms-word、application/ms-txt、application/ms-html 或其他浏览器可直接支持文档
Response.ContentType = "application/vnd.ms-excel";
Response.Write("<meta http-equiv=Content-Type content=\"text/html; charset=gb2312\">");
this.EnableViewState = true;
// 定义一个输入流
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
oStringWriter.Write("<table><tr align='center' style='border:1px #000 solid;'><td width='80'>记录编号</td><td width='80'>用户姓名</td><td width='80'>缴费学生姓名</td><td width='80'>缴费年度</td><td width='80'>年度应缴金额</td><td width='80'>实缴金额</td><td width='80'>欠费金额</td><td width='150'>记录时间</td></tr>");
this.rptList.RenderControl(oHtmlTextWriter);
oStringWriter.Write("</table>");
//this.rptList.RenderControl(oHtmlTextWriter);
//this 表示输出本页,或其他支持obj.RenderControl()属性的控件
Response.Write(oStringWriter.ToString());
Response.End();
- 导出Excel--处理标题
- jxl导出excel标题乱码
- jxl导出excel标题乱码
- poi处理excel导出
- 火狐浏览器POI导出Excel标题乱码
- Java poi导出excel合并标题单元格
- js 导出excel,设置下载的标题
- js 导出excel,设置下载的标题
- Java poi导出excel合并标题单元格
- easyui datagrid标题和数据 导出excel
- java使用poi导出Excel(Excel为双标题)
- 处理Excel表格标题技巧二则
- gridview导出到excel格式及标题样式
- DW导出到excel文件(标题、数据)
- PowerBuilder 将导出的EXCEL英文标题替换为汉字
- 导出Excel标题不能显示中文的解决办法
- 关于js导出excel的标题日期问题
- 2017/11/23 导出excel时 标题符号 变乱码
- javascript中的apply和call
- 《大话数据结构》读书笔记(四)
- 2013、1、7待看
- 黑马程序员---关于访问控制符的问题:
- Android GestureDetector手势识别类
- 导出Excel--处理标题
- 一个简单的Android进程管理器(初稿)
- 黑马程序员--类的构造函数
- 第一章 Spring 基础介绍
- centos下安装和使用apache
- perl 自定义包/模块的使用(正则表达式匹配email地址和ip)
- mysql 不区分声调 'e' 'é'
- ATLBASE.H
- javascript下对结构体数组元素的操作