private void export_to_word()
{
try
{
data_grid_print.Visible = true;
//grd_detail.Visible = true;
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=FileName.doc");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.word";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
data_grid_print.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
htmlWrite.Flush();
//grd_detail.Visible = false;
data_grid_print.Visible = false;
}
catch (Exception ex)
{
}
}
{
try
{
data_grid_print.Visible = true;
//grd_detail.Visible = true;
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=FileName.doc");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.word";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
data_grid_print.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
htmlWrite.Flush();
//grd_detail.Visible = false;
data_grid_print.Visible = false;
}
catch (Exception ex)
{
}
}
02:42
|
Category:
|
0
comments
Comments ( 0 )