|
Subject:
|
export to excel (Urgent)
|
|
Posted By:
|
balesh.mind
|
Post Date:
|
8/21/2008 11:36:45 PM
|
Dear all, I am exporting a grid to excel. While exporting everthing work fine. But after 1700 records all the fields changes to text. Means now we can't use them in formula. Kindly Help Code is as follow: grdDetails.AllowPaging = false; BindGrid();
grdDetails.HeaderStyle.BackColor = System.Drawing.Color.White; grdDetails.HeaderStyle.ForeColor = System.Drawing.Color.Black; string attachment = "attachment; filename=Report.xls"; Response.ClearContent(); Response.AddHeader("content-disposition", attachment); Response.ContentType = "application/ms-excel"; StringWriter sw = new StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); // Create a form to contain the grid HtmlForm frm = new HtmlForm();
grdDetails.Parent.Controls.Add(frm); frm.Attributes["runat"] = "server"; frm.Controls.Add(grdDetails); frm.RenderControl(htw); //GridView1.RenderControl(htw); //string styleInfo = @".NumberString {mso-number-format:\@;}"; Response.Write(sw.ToString()); Response.End(); grdDetails.AllowPaging = true;
|
|
Reply By:
|
MunishBhatia
|
Reply Date:
|
8/30/2008 9:30:11 AM
|
i donot feel bug here in code
thanks......
|
|