HighTechTalks DotNet Forums  

Cell Data too Large When converting DataGrid to Excel

Dotnet General Discussions microsoft.public.dotnet.general


Discuss Cell Data too Large When converting DataGrid to Excel in the Dotnet General Discussions forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
hangar18
 
Posts: n/a

Default Cell Data too Large When converting DataGrid to Excel - 12-19-2007 , 07:13 AM






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();


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.