如题,求解,之前使用了
curContext.Response.Write(sw.ToString().Replace("<br/>", "<br style='mso-data-placement:same-cell;'/> "));
和
gv.Cells[0].Attributes.Add("style", "<br style='mso-data-placement:same-cell;'/> ");
好像都没起作用
curContext.Response.Write(sw.ToString().Replace("<br/>", "<br style='mso-data-placement:same-cell;'/> "));
和
gv.Cells[0].Attributes.Add("style", "<br style='mso-data-placement:same-cell;'/> ");
好像都没起作用
{
Export("application/ms-excel", "表名字.xls");
}
private void Export(string FileType, string FileName)
{
Response.Charset = "GB2312";
Response.ContentEncoding = System.Text.Encoding.UTF7;
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString());
Response.ContentType = FileType;
this.EnableViewState = false;
StringWriter tw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(tw);
rptCustomerDemand.RenderControl(hw);
Response.Write(tw.ToString());
Response.End();
}
DataGrid导出Excel单元格换行问题