Error exporting DataGrid to excel file using RenderControl

G

Guest

I have a button in my html page for exporting to excel files using the
RenderControl function. When the table generated is small in rows size it
works fine, but when there are much more rows (more than 5000) the excel loss
format in the last rows mainly in Rowsan or Colspan property for the table.
This is the code I'm using

Response.Clear();
Response.Buffer=true;
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new
System.Web.UI.HtmlTextWriter(oStringWriter);

Page.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();


Some help?
 
G

Guest

I can't believe, it isn't the first time I need help from this newsgroup
without any answer, especially in asp.net tecnology. How can I solve problems
without help?
 
P

Peter Bromberg [MVP]

Beats me. Have you tried adding a "Response.Flush()" just before the
Response.End() ??
Peter
 
G

Guest

Thanks Peter

I put the Response.Flush as you tell me but I'm still having the same bug,
some other idea?

Especifically the bug is when tranforming Rowspan with more than 280 of
value (rows) to merging rows in excel, the total rows in file is greater than
4000 or 5000

If you can help me I can send you the output web page and the excel file
exported to some e-mail. My email is (e-mail address removed). Please I need
help.
 

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