Below code is
used to export row from DataList to Word.
private void
ExportToWord(DataList DataList1)
{
Response.Clear();
Response.AddHeader("content-disposition",
"attachment;filename=mydoc.doc");Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.word";
System.IO.StringWriter stringWrite = new
System.IO.StringWriter();//stringWrite.ToString(
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
DataList1.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}
No comments:
Post a Comment