【发布时间】:2012-01-07 20:51:39
【问题描述】:
我正在将网格表添加到 excel 中,并在 excel 中添加标题。
string subject = lbl_Subj.Text;
Response.Clear();
Response.Buffer = true;
Response.ClearHeaders();
Response.AddHeader("Cache-Control", "no-store, no-cache");
Response.AddHeader("content-disposition", "attachment;filename=" + subject + "-Status");
Response.Charset = "";
this.EnableViewState = false;
Response.ContentType = "application/vnd.ms-excel";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
Grid_UserTable.RenderControl(htmlWrite);
rptList.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
如何在 excel 中添加一些文本,我想添加一些类似的字符串
string add="this is the text I want to add to the excel";
【问题讨论】:
标签: c# htmltextwriter stringwriter