Cell Data too Large When converting DataGrid to Excel

Cell Data too Large When converting DataGrid to Excel

am 19.12.2007 13:13:16 von hangar18

Hi,
We are using the following code to convert a datagrid to an excel
output. This works fine except that the issue is we get this error
message "Cell Data too Large".
How can we resolve this. Appreciate the help.

The code is as follows:

ReportFacade reportFacade = new ReportFacade();
DataSet ds = null;
ds = reportFacade.GetExcelReportData(excelReportEntity);

GridView grd = new GridView();
//System.Drawing.Color colour = new
System.Drawing.Color();
//colour = System.Drawing.Color.Gray;
//grd.HeaderRow.BackColor = colour;

grd.DataSource = ds;
grd.DataBind();
current.Response.Clear();
current.Response.AddHeader("content-disposition",
string.Format("attachment; filename={0}",
excelReportEntity.FileName));
current.Response.ContentType = "application/ms-excel";

//Response.Charset = "";
//this.EnableViewState = false;
System.IO.StringWriter oStringWriter = new
System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new
System.Web.UI.HtmlTextWriter(oStringWriter);
this.ClearControls(grd);
//oHtmlTextWriter =
oHtmlTextWriter.ToString().Replace(" x:autofilter=''''all''''");
grd.RenderControl(oHtmlTextWriter);
string s = oStringWriter.ToString();

s = header + s + "";



s = s.Replace("
current.Response.Write(s);
current.Response.Flush();
current.Response.End();