当前位置: 代码迷 >> ASP.NET >> 关于导出excel 自定换行有关问题
  详细解决方案

关于导出excel 自定换行有关问题

热度:8581   发布时间:2013-02-25 00:00:00.0
关于导出excel 自定换行问题
本人做了一个excel 导出, 是输出 html 直接导入excel ,导入进去,数据自动换行了,需求是不能换行,怎么做到
  sbHtml.Append("<td style=\"width:40px; text-align:center; vertical-align:middle;font-size:15px; font-weight: bold; height:49px;\">" + day + "</td>");

本人代码

------解决方案--------------------------------------------------------
把导出到Excel的代码给出来看看啊,

C# code
System.IO.StringWriter sw = new System.IO.StringWriter();sw.Write("<td style=\"width:40px; text-align:center; vertical align:middle;font-size:15px; font-weight: bold; height:49px;\">" + 0 + "</td>");sw.Close();Response.Clear();Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");Response.AddHeader("Content-Disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("测试", System.Text.Encoding.UTF8) + DateTime.Now.ToShortDateString() + ".xls");Response.ContentType = "application/ms-excel";Response.Write(sw);Response.End();
  相关解决方案