我正在从 gridview 导出 excel,但它并没有给我很好的格式。图像显示在 excel 文件中。我不想要图像,我该怎么办?
这是我的代码
protected void Export_to_Excel(object sender, EventArgs e)
{
//System.Diagnostics.Debugger.Break();
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=vault-extract-nsf.xls");
Response.ContentType = "application/vnd.xlsx";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
GridView1.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}