In the below code i am export excel from grid when export the leading zeros get deleted.I want to maintain the leading zero.Please help me to solve the issue.
HtmlForm form = new HtmlForm();
Response.Clear();
Response.Buffer = true;
Response.Charset = "";
Response.AddHeader("content-disposition", string.Format("attachment;filename={0}", "Supply/DemandReport.xls"));
Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
gdSupplyorDemand.AllowPaging = false;
gdSupplyorDemand.HeaderStyle.ForeColor = System.Drawing.Color.Black;
form.Attributes["runat"] = "server";
form.Controls.Add(gdSupplyorDemand);
this.Controls.Add(form);
form.RenderControl(hw);
string style = @"<style> .textmode { mso-number-form at:\@;}</style>";
Response.Write(style);
Response.Output.Write(sw.ToString());
Response.Flush();
Response.End();
Aucun commentaire:
Enregistrer un commentaire