我有一个网页,其中有一些数据的gridview。我想将数据导出到excel工作表,因为我想屏蔽一列数据。
这是我导出到excel代码的地方。我如何修改代码以掩盖特定的列数据。有什么建议吗?
private void ExportGridToExcel()
{
Response.ClearContent();
string FileName = "Report" + DateTime.Now + ".xls";
Response.AddHeader("content-disposition", "attachment; filename=" + FileName);
Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
this.GridView1.RenderControl(new HtmlTextWriter(sw));
string style = @"<style> td { mso-number-format:\@;} </style>";
Response.Write(style);
Response.Write(sw.ToString());
Response.End();
}