什么是最好的方式来创build.xls从数据表在asp.net c#中?

我有一个数据表,我想从中导出excel,我的数据表包含unicode字符(波斯字符),我想正确地将其转换为.xls文件。 我想知道是否有可能与Stimulsoft做到这一点?

这是我使用的常用方法

public void ExportDetails(DataTable tempDataTable, string FileName) { try { System.IO.StringWriter objStringWriter1 = new System.IO.StringWriter(); System.Web.UI.WebControls.GridView gridView1 = new System.Web.UI.WebControls.GridView(); System.Web.UI.HtmlTextWriter objHtmlTextWriter1 = new System.Web.UI.HtmlTextWriter(objStringWriter1); HttpContext.Current.Response.ClearContent(); HttpContext.Current.Response.ClearHeaders(); HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"; HttpContext.Current.Response.Charset = ""; HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName); HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Unicode; Response.BinaryWrite(System.Text.Encoding.Unicode.GetPreamble()); gridView1.DataSource = tempDataTable; gridView1.DataBind(); gridView1.HeaderStyle.Font.Bold = true; gridView1.HeaderStyle.BackColor = System.Drawing.Color.Gray; gridView1.RenderControl(objHtmlTextWriter1); gridView1.Dispose(); HttpContext.Current.Response.Write(objStringWriter1.ToString()); HttpContext.Current.Response.End(); } catch (Exception ex) { } }