當(dāng)我把GrideView中的數(shù)據(jù)導(dǎo)出到Excel 時(shí),如果時(shí)漢字和數(shù)字,字母都能正常,但是但GrideView中含有日期類型時(shí),卻什么都倒不出,GridView數(shù)據(jù)格式為: 02 21 2009 2:37PM 1 大河報(bào),生成代碼如下: Response.Clear(); Response.Buffer = false; Response.Charset = "UTF-8"; Response.AppendHeader("Content-Disposition", "attachment;filename=pkmv_de.xls"); Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8"); Response.ContentType = "application/ms-excel"; Response.Write("<meta http-equiv=Content-Type content=\"text/html; charset=UTF-8\">");//防止輸出亂碼 this.EnableViewState = false; System.IO.StringWriter oStringWriter = new System.IO.StringWriter(); HtmlTextWriter oHtmlTextWriter = new HtmlTextWriter(oStringWriter); GridView1.RenderControl(oHtmlTextWriter); Response.Write(oStringWriter.ToString()); Response.End();
GridView 導(dǎo)出 Excel 出現(xiàn)問(wèn)題(日期類型)
長(zhǎng)風(fēng)秋雁
2018-11-07 09:05:27