Cell Data too Large When converting DataGrid to Excel

H

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<DataSet> reportFacade = new ReportFacade<DataSet>();
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("<th ", "<th
x:autofilter=''''all''''");
grd.RenderControl(oHtmlTextWriter);
string s = oStringWriter.ToString();

s = header + s + "</HTML>";



s = s.Replace("<th ", "<th x:autofilter='all' ");

current.Response.Write(s);
current.Response.Flush();
current.Response.End();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top