datagrid向Excel导出的时候,超链接列的下划线不想要,怎么办
datagrid中的第一列是超链接列,导出的时候在EXCEl里面也是超链接,我只想要文本,这样好打印,不知道各位有什么好办法,嗯,最好是简单点的,但是说明要详细哦,谢谢,下面复制我的原码,大家出出主意
public void ExportExcelFromDataGrid
(string filename, System.Web.UI.WebControls.DataGrid ToExcelGrid)
{
Response.Clear();
Response.Buffer = true;
Response.Charset = "utf-8 ";
Response.AppendHeader( "Content-Disposition ", "attachment;filename= " + Server.UrlEncode(filename));
Response.ContentEncoding = System.Text.Encoding.Default;//设置输出流为简体中文
Response.ContentType = "application/ms-excel ";//设置输出文件类型为excel文件。
this.EnableViewState = false;
System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo( "ZH-CN ", true);
System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad);
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
ToExcelGrid.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
}
public void Button_Click(object sender, System.EventArgs e)
{
string filename = "empolyee_info.xls ";
this.infoviewGrid.ItemDataBound += new DataGridItemEventHandler(DataGridItemDataBound);
this.infoviewGrid.AllowSorting = false; // *
this.infoviewGrid.AllowPaging = false;
this.infoviewGrid.SelectedIndex = -1; // *
this.BindDataGird();
this.ExportExcelFromDataGrid(filename, this.infoviewGrid);
}
private void DataGridItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs &nbs