G
giasone777
Guest
I have the following code that exports a gridview.net box from c# to excel but the gridlines do not show up in the spreadsheet-
If anyone can help it would be much appreciated - thank-you - Jason.
Response.Clear();
Response.Buffer = true;
Response.Charset = "";
Response.ContentType = "application / vnd.openxmlformats - officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", "attachment;filename=SqlExport.xls");
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
GridView1.RenderControl(htmlWrite);
Response.Write("<Gridlines=both>");
GridView1.GridLines = GridLines.Both;
GridView1.DataBind();
GridView1.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.Write("</table>");
Response.End();
Continue reading...
If anyone can help it would be much appreciated - thank-you - Jason.
Response.Clear();
Response.Buffer = true;
Response.Charset = "";
Response.ContentType = "application / vnd.openxmlformats - officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", "attachment;filename=SqlExport.xls");
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
GridView1.RenderControl(htmlWrite);
Response.Write("<Gridlines=both>");
GridView1.GridLines = GridLines.Both;
GridView1.DataBind();
GridView1.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.Write("</table>");
Response.End();
Continue reading...