samedi 18 avril 2015

Excel Export Issue

In the below code i am exporting excel from grid view when i export only first page of gridview is binded in excel not remaining page and the value likes 1.000 are changed to 1 i want 1.000 to be in excel.Please help me to overcome this issue.



HtmlForm form = new HtmlForm();
Response.Clear();
Response.Buffer = true;
Response.Charset = "";
Response.AddHeader("content-disposition", string.Format("attachment;filename={0}", "ProductValuationReport.xls"));
Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
GridOpenstk.AllowPaging = false;
GridOpenstk.HeaderStyle.ForeColor = System.Drawing.Color.Black;

form.Attributes["runat"] = "server";
form.Controls.Add(GridOpenstk);
this.Controls.Add(form);
form.RenderControl(hw);
string style = @"<style> .textmode { mso-number-format:\@;}</style>";
Response.Write(style);
Response.Output.Write(sw.ToString());
Response.Flush();
Response.End();

Aucun commentaire:

Enregistrer un commentaire