StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
Response.ClearContent();
Response.Charset = "";
htw.Write("<table border=2><b><tr><td align=center>Name</td><td>Mobile No.</td><td>Alternate No.</td><td align=center>Email</td><td>Date of Birth</td><td>Gender</td><td>Marital Status</td><td align=center>Spouse Name</td><td>Spouse Mobile</td><td>Spouse Alternate No.</td><td>Spouse Date of Birth</td><td align=center>Residential Address</td><td align=center>Official Address</td><td>Car</td><td>Car Brand</td><td>Car No.</td><td align=center>Father Name</td><td>Father Mobile No.</td><td>Father Date of Birth</td><td align=center>Mother Name</td><td>Mother Mobile No.</td><td>Mother Date of Birth</td><td align=center>Brother Name</td><td>Brother Mobile No.</td><td>Brother Date of Birth</td><td align=center>Sister Name</td><td>Sister Mobile No.</td><td>Sister Date of Birth</td><td>Credit Card No.</td align=center><td>Delivery Address</td><td>Anniversary Date</td><td>No. of Child</td><td>Child Name</td><td>Child Mobile no.</td><td align=center>Child School</td><td>Child Name</td><td>Child Mobile no.</td><td align=center>Child School</td><td>Child Name</td><td>Child Mobile no.</td><td align=center>Child School</td><td>Child Name</td><td>Child Mobile no.</td><td align=center>Child School</td><td>Child Name</td><td>Child Mobile no.</td><td align=center>Child School</td><td>Date</td><td>Ticket No.</td><td>Temprorary</td><td>Temprorary</td><td>Temprorary</td></tr></b></table>");
Response.ClearContent();
Response.Charset = "";
Response.AddHeader("content-disposition", "attachment; filename=Squarekart_log.xls");
Response.ContentType = "application/vnd.ms-excel";
GridView gridExcel = new GridView();
gridExcel.ShowHeader = false; // hide header comes from sql
gridExcel.RowStyle.Font.Size = FontUnit.Point(9);
gridExcel.AlternatingRowStyle.Font.Size = FontUnit.Point(9);
gridExcel.AlternatingRowStyle.ForeColor = System.Drawing.Color.FromName("Black");
gridExcel.AlternatingRowStyle.BackColor = System.Drawing.Color.FromName("White");
gridExcel.RowStyle.BackColor = System.Drawing.Color.FromName("White");
gridExcel.RowStyle.ForeColor = System.Drawing.Color.FromName("Black");
gridExcel.HeaderStyle.Font.Bold = true;
gridExcel.AllowPaging = false;
gridExcel.AllowSorting = false;
gridExcel.GridLines = GridLines.Both;
gridExcel.DataSource = dobj.search_dashboard(txtfrom.Text, txtto.Text, txtmob.Text, txtname.Text);
gridExcel.DataBind();
//StringWriter sw = new StringWriter();
//HtmlTextWriter htw = new HtmlTextWriter(sw);
gridExcel.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
HtmlTextWriter htw = new HtmlTextWriter(sw);
Response.ClearContent();
Response.Charset = "";
htw.Write("<table border=2><b><tr><td align=center>Name</td><td>Mobile No.</td><td>Alternate No.</td><td align=center>Email</td><td>Date of Birth</td><td>Gender</td><td>Marital Status</td><td align=center>Spouse Name</td><td>Spouse Mobile</td><td>Spouse Alternate No.</td><td>Spouse Date of Birth</td><td align=center>Residential Address</td><td align=center>Official Address</td><td>Car</td><td>Car Brand</td><td>Car No.</td><td align=center>Father Name</td><td>Father Mobile No.</td><td>Father Date of Birth</td><td align=center>Mother Name</td><td>Mother Mobile No.</td><td>Mother Date of Birth</td><td align=center>Brother Name</td><td>Brother Mobile No.</td><td>Brother Date of Birth</td><td align=center>Sister Name</td><td>Sister Mobile No.</td><td>Sister Date of Birth</td><td>Credit Card No.</td align=center><td>Delivery Address</td><td>Anniversary Date</td><td>No. of Child</td><td>Child Name</td><td>Child Mobile no.</td><td align=center>Child School</td><td>Child Name</td><td>Child Mobile no.</td><td align=center>Child School</td><td>Child Name</td><td>Child Mobile no.</td><td align=center>Child School</td><td>Child Name</td><td>Child Mobile no.</td><td align=center>Child School</td><td>Child Name</td><td>Child Mobile no.</td><td align=center>Child School</td><td>Date</td><td>Ticket No.</td><td>Temprorary</td><td>Temprorary</td><td>Temprorary</td></tr></b></table>");
Response.ClearContent();
Response.Charset = "";
Response.AddHeader("content-disposition", "attachment; filename=Squarekart_log.xls");
Response.ContentType = "application/vnd.ms-excel";
GridView gridExcel = new GridView();
gridExcel.ShowHeader = false; // hide header comes from sql
gridExcel.RowStyle.Font.Size = FontUnit.Point(9);
gridExcel.AlternatingRowStyle.Font.Size = FontUnit.Point(9);
gridExcel.AlternatingRowStyle.ForeColor = System.Drawing.Color.FromName("Black");
gridExcel.AlternatingRowStyle.BackColor = System.Drawing.Color.FromName("White");
gridExcel.RowStyle.BackColor = System.Drawing.Color.FromName("White");
gridExcel.RowStyle.ForeColor = System.Drawing.Color.FromName("Black");
gridExcel.HeaderStyle.Font.Bold = true;
gridExcel.AllowPaging = false;
gridExcel.AllowSorting = false;
gridExcel.GridLines = GridLines.Both;
gridExcel.DataSource = dobj.search_dashboard(txtfrom.Text, txtto.Text, txtmob.Text, txtname.Text);
gridExcel.DataBind();
//StringWriter sw = new StringWriter();
//HtmlTextWriter htw = new HtmlTextWriter(sw);
gridExcel.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
No comments:
Post a Comment