我將網格表添加到Excel中並向Excel中添加標題。如何寫一些文本到C#中的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";